Hi, this blog is no longer maintained, my new blog is here

Ruby On Rails and a Conning Israeli entrepreneur

Rails Migrations - Running a Single Migration

We all know the good old

rake db:migrate
And we all know the Rails 2.x
rake db:migrate:rollback
to go back in time and fix what we did.
Now, in Rails 2.x you can specify a single migration by specifing one of the each
rake db:migrate:up VERSION=<migration_timestamp> # Runs the self.up
rake db:migrate:down VERSION=<migration_timestamp> # Runs the self.down
Note that migrations are meant to be concurrent and that's the most basic purpose in which they are there for, executing an out of line migration may cause you problems in the future, so try to stay as clean as possible when dealing with migrations

2 comments:

  Mechu

January 21, 2009 at 4:26 AM

nice!

you just solved me an ancient problem!
thanks.

  Elad Meidar

January 21, 2009 at 8:51 AM

NP.
I am always up to some old-school quirks :)


The Web Ask eizesus.com

Subscribe

    follow me on Twitter

    Twiters Around

    About Me

    My photo
    I am a web developer for more than 9 years, managed, cried, coded, designed and made money in this industry. now trying to do it again.

    Blog Archive

    Labels