Show migrations status (executed and pending migrations):

rails db:migrate:status

Migrate (or rollback) until specific version:

rails db:migrate RAILS_ENV=development VERSION=20100905201547

Rollback ONLY the specific version:

rails db:migrate:down VERSION=20100905201547

And run ONLY a specific version:

rake db:migrate:up VERSION=20100905201547

Rollback the most recent migration:

rake db:rollback

Rollback the n most recent migrations:

rake db:rollback STEP=n

Redo: rollback and run it again

  • rake db:migrate:redo - Roll back one migration and run it again

  • rake db:migrate:redo STEP=n - Roll back the last n migrations and run


👉 StackOverflow: How can I rollback a specific migration?

👉 StackOverflow: How to rollback just one step using rake db:migrate