Is there a rake task for advancing or retreating your schema version by exactly one?

Posted by user30997 on Stack Overflow See other posts from Stack Overflow or by user30997
Published on 2009-03-23T23:27:20Z Indexed on 2010/04/05 7:43 UTC
Read the original article Hit count: 481

Filed under:
|
|

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

?

© Stack Overflow or respective owner

Related posts about rake

Related posts about migrate