How to revert all migrations at once in Ruby on Rails 3?

Misha Moroshko picture Misha Moroshko · Dec 9, 2010 · Viewed 8.4k times · Source

I tried to run:

rake db:migrate VERSION=0

It reverts all migrations except the last one.

Then I tried to run:

rake db:migrate:down VERSION=<timestamp_of_last_migration>

but it didn't revert either. Why ?

Is there a command that runs all down methods at once ?

Answer

boymc picture boymc · Dec 9, 2010

If your database only related to this project, and you are trying to undo everything in your migrations, I'd simply drop the database, and then run rake db:create.

Then you have an empty database ready to go.

Or is there another reason you're trying to run the down scripts?