views:

195

answers:

2

Back when migration version numbers were simply incremented as you created migrations, it was easy enough to do:

rake migrate VERSION=097
rake migrate VERSION=098
rake migrate VERSION=099
rake migrate VERSION=100

...but we now have migration numbers that are something like YYYYMMDDtimeofday. Not that this is a bad thing - it keeps the migration version collisions to a minimum - but when I have 50 migrations and want to step through them one-at-a-time, it is a hassle:

rake migrate VERSION=20090129215142
rake migrate VERSION=20090129219783

...etc. I have to have a list of all the migrations open in front of me, typing out the version numbers to advance by one. Is there anything that would have an easier syntax, like:

rake migrate VERSION=NEXT

or

rake migrate VERSION=PREV

?

A: 

You rollback to the previous migration with rake db:rollback. It doesn't look like you can go forward by only one migration though.

Matt Haley
A: 

You can also rollback to a very old version too.

rake db:rollback VERSION=YYYYMMDDtimeofday

Shripad K