Migrations aren't migrating..

I have an odd problem with migrations which is driving me mental!

Originally, I had several migrations, but rake didn't seem to want to
get past migration number 2. I thought this might have something to do
with the third migration being generated via "rake db:sessions:create"
However, I've subsequently trimmed it down to the following example,
and the same problem occurs:

I'm not getting any errors, it seams as though it thinks everything is
working as it should, but I disagree! Below is an example... starting
with an empty database and 0 files in my migration folder, I create 4
blank migrations (with stub 'up' and 'down' methods). When I run "rake
db:migrate" it updates to version 2. When I run "rake db:migrate
VERSION=4" it processes the other two files (which I think it should
have done before). If I then run "rake db:migrate" again, it rolls-back
to version 2.

In the code below, I ran it with the --trace option, but that doesn't
mean much to me ...
F:\ror\trunk\test>ruby script/generate migration test_1
exists db/migrate
create db/migrate/001_test1.rb

F:\ror\trunk\test>ruby script/generate migration test_2
exists db/migrate
create db/migrate/002_test2.rb

F:\ror\trunk\test>ruby script/generate migration test_3
exists db/migrate
create db/migrate/003_test3.rb

F:\ror\trunk\test>ruby script/generate migration test_4
exists db/migrate
create db/migrate/004_test4.rb

F:\ror\trunk\test>rake db:migrate --trace
(in F:/ror/trunk/test)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
== Test1: migrating ==================================================

The only thing I can think of is somewhere VERSION is set to 2. Remember that with Rake, such arguments are in-fact set in the system environment (ENV). When you specify VERSION=4, you overwrite the value, otherwise it’s back to 2. Check your environment settings, and make sure that there isn’t a config file setting VERSION=2 for some strange reason.


You were correct! Thanks, I would not have figured that out in a
million years!