# Schema\_info always wants to be 3, even when set to 7

**URL:** <https://www.ruby-forum.com/t/schema-info-always-wants-to-be-3-even-when-set-to-7/119919>\
**Category:** Rails\
**Created:** [November 12, 2007, 8:20am UTC](https://www.ruby-forum.com/t/schema-info-always-wants-to-be-3-even-when-set-to-7/119919 "2007-11-12T08:20:49Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![combray](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/eada6e/32.png) [@combray](https://www.ruby-forum.com/u/combray)\
**Post date:** [November 12, 2007, 8:20am UTC](https://www.ruby-forum.com/t/schema-info-always-wants-to-be-3-even-when-set-to-7/119919/1 "2007-11-12T08:20:49Z")

</div>

Hi all,

I’m having a very odd problem with db:migrate. I’m using Rails 1.2.5  
on Windows XP SP2 and Ruby 1.8.6

I have seven migrations. If I run them with an empty database, it  
runs the first three, then halts. When I look in schema\_info, the  
version is 3.

If I run db:migrate VERSION=7, then it runs through the remaining 4  
migrations, and the version is 7 in the DB. Committed and everything.

If I then run db:migrate on its own, then Rails will REVERT BACK those  
4 migrations and set the version to 3 again.

I don’t understand this behaviour. I’ve tried --trace and --verbose  
and neither explains why it is that Rails wants to roll back when the  
version is 7.

I’ve only just recently arrived to Rails and Rake, so I’m not familiar  
with the internal structure, but I don’t see this behaviour mentioned  
in any of the documentation. Can anyone help?

Will.

---

<div class="post-metadata">

**Author:** ![combray](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/eada6e/32.png) [@combray](https://www.ruby-forum.com/u/combray)\
**Post date:** [November 12, 2007, 9:01am UTC](https://www.ruby-forum.com/t/schema-info-always-wants-to-be-3-even-when-set-to-7/119919/2 "2007-11-12T09:01:45Z")

</div>

It would be beneficial if you can send us the output that is presented  
to you while you do the db:migrate.  
Specially from migrating your db schema to an empty database.

Dima

---

<div class="post-metadata">

**Author:** ![combray](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/eada6e/32.png) [@combray](https://www.ruby-forum.com/u/combray)\
**Post date:** [November 12, 2007, 10:18am UTC](https://www.ruby-forum.com/t/schema-info-always-wants-to-be-3-even-when-set-to-7/119919/3 "2007-11-12T10:18:56Z")

</div>

On Nov 12, 12:00 am, Dejan D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> It would be beneficial if you can send us the output that is presented  
> to you while you do the db:migrate.  
> Specially from migrating your db schema to an empty database.

# D:\home\wsargent\work\blog3\>rake db:migrate (in D:/home/wsargent/work/blog3) == CreatePosts: migrating

# – create\_table(:blog\_post, {:id=\>false}) → 0.0790s – execute(“alter table blog\_post add constraint blog\_post\_pk primary key (post\_id)”) → 0.0620s == CreatePosts: migrated (0.1410s)

# == CreateComments: migrating

# – create\_table(:blog\_comment, {:primary\_key=\>“comment\_id”, :id=\>false}) → 0.0620s – execute(“alter table blog\_comment add constraint blog\_comment\_pk primary key (comment\_id)”) → 0.0470s – execute(“ALTER TABLE blog\_comment\n ADD CONSTRAINT blog\_comment\_post\_id\_fk\n FOREIGN KEY (post\_id)\n REFERENCES blog\_post (post\_id)\n ON DELETE CASCADE”) → 0.0310s == CreateComments: migrated (0.1400s)

# == CreateUsers: migrating

# – create\_table(:blog\_user) → 0.1410s == CreateUsers: migrated (0.1410s)

---

<div class="post-metadata">

**Author:** ![combray](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/eada6e/32.png) [@combray](https://www.ruby-forum.com/u/combray)\
**Post date:** [November 12, 2007, 7:29pm UTC](https://www.ruby-forum.com/t/schema-info-always-wants-to-be-3-even-when-set-to-7/119919/4 "2007-11-12T19:29:10Z")

</div>

On Nov 12, 5:09 am, Rob B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> You likely have an environment variable named VERSION that is set to 3  
> (or something that .to\_i makes into 3).
> 
> Since you’re on Windows, see what the output from:
> 
> ```
> set
> 
> ```
> 
> shows to you. (Of course, the Unix equivalent is `env` for those  
> playing along at home.)

Thanks; that’s exactly what I would have never thought of.

D:\home\wsargent\work\blog3\>echo %VERSION%  
3.5.0

Nasty. I wonder what software was responsible for installing that?

Will.

---

<div class="post-metadata">

**Author:** ![combray](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/eada6e/32.png) [@combray](https://www.ruby-forum.com/u/combray)\
**Post date:** [November 13, 2007, 9:00am UTC](https://www.ruby-forum.com/t/schema-info-always-wants-to-be-3-even-when-set-to-7/119919/5 "2007-11-13T09:00:08Z")

</div>

I always feel a great satisfaction when individual problems are solved  
by the community.  
Thanks you all out there one more time for your effort.

Dima

---

<div class="post-metadata">

**Author:** ![combray](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/eada6e/32.png) [@combray](https://www.ruby-forum.com/u/combray)\
**Post date:** [November 13, 2007, 3:31pm UTC](https://www.ruby-forum.com/t/schema-info-always-wants-to-be-3-even-when-set-to-7/119919/6 "2007-11-13T15:31:33Z")

</div>

Mr. Biedenharn,  
I am very grateful to observe your answer here and find the  
implications of viewing ones’ SET variables as instrumental to running  
on a Windows XP machine. Would you by chance know how to change these  
at the DOS command line?  
Thank you,  
Kathleen

On Nov 12, 7:09 am, Rob B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![combray](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/eada6e/32.png) [@combray](https://www.ruby-forum.com/u/combray)\
**Post date:** [November 12, 2007, 2:10pm UTC](https://www.ruby-forum.com/t/schema-info-always-wants-to-be-3-even-when-set-to-7/119919/7 "2007-11-12T14:10:13Z")

</div>

You likely have an environment variable named VERSION that is set to 3  
(or something that .to\_i makes into 3).

Since you’re on Windows, see what the output from:

set

shows to you. (Of course, the Unix equivalent is `env` for those  
playing along at home.)

If you don’t need that variable for something else, try:

unset VERSION

or always specify the VERSION when you migrate:

rake db:migrate VERSION=7

Please post back if this solves your problem.

-Rob

On Nov 12, 2007, at 4:18 AM, Will S. wrote:

> # ===================================================== – create\_table(:blog\_comment,
> 
> # == CreateUsers: migrating
> 
> # – create\_table(:blog\_user) → 0.1410s == CreateUsers: migrated (0.1410s)

Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![combray](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/eada6e/32.png) [@combray](https://www.ruby-forum.com/u/combray)\
**Post date:** [November 13, 2007, 11:03pm UTC](https://www.ruby-forum.com/t/schema-info-always-wants-to-be-3-even-when-set-to-7/119919/8 "2007-11-13T23:03:38Z")

</div>

It’s been a while since I’ve had a Windows system around, but I  
believe either:  
unset VERSION  
or possibly:  
set VERSION=  
might work.

If you’re actually in Windows, not DOS, you can go to ControlPanel-

> System-\>Environment and remove the setting of the VERSION variable.  
> (The details of getting to that window are only approximate!)

-Rob

On Nov 13, 2007, at 9:19 AM, removed\_email\_address@domain.invalid wrote:

> wrote:
> 
> > -Rob
> > 
> > > > It would be beneficial if you can send us the output that is  
> > > > – execute("alter table blog\_post add constraint blog\_post\_pk  
> > > > → 0.0620s  
> > > > == CreateUsers: migrating
> 
> >

Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid  
+1 513-295-4739  
Skype: rob.biedenharn
