Ruby on Rails Rollback migrations


Example

To rollback the latest migration, either by reverting the change method or by running the down method. Run command:

5.0
rake db:rollback
5.0
rails db:rollback

Rollback the last 3 migrations

5.0
rake db:rollback STEP=3
5.0
rails db:rollback STEP=3

STEP provide the number of migrations to revert.

Rollback all migrations

5.0
rake db:rollback VERSION=0
5.0
rails db:rollback VERSION=0