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