How to rollback just one step using rake db:migrate

mko picture mko · Dec 4, 2010 · Viewed 136.3k times · Source

After adding migration files in the db/migrate folder and running rake db:migrate, I want get back to the previous step, I think using VERSION=n is the right way to do that, but I don't know the correct value of n to use. Is there any command to check the current n value?

It would be great if anyone could provide full instructions on how to use rake db:migrate.

Answer

rwilliams picture rwilliams · Dec 4, 2010

For starters

rake db:rollback will get you back one step

then

rake db:rollback STEP=n

Will roll you back n migrations where n is the number of recent migrations you want to rollback.

More references here.