Categories
Rails

Ruby on Rails: rake db:migrate:redo rake db:rollback

This is the way to test your migrations back and forth. rake db:redo or rake db:migrate redo won’t work. But this one does the trick.

To go back in time to a certain migration version, you can run:

$ rake db:migrate VERSION=0

And, of course, to migrate back one version, you do: db:rollback