how to rollback migration rails code example Example 1: rails revert migration rake db:rollback Example 2: rails redo last migration rake db:migrate:redo STEP=n