karenc / db-migrator

GNU Affero General Public License v3.0
4 stars 5 forks source link

Avoid rollback suprise #46

Open reedstrm opened 7 years ago

reedstrm commented 7 years ago

Currently, list shows all migrations in date-hash-name order. Before the introduction of deferred migrations, that meant it was the order they had been applied, and the reverse order (from the bottom up) of what will rollback. Now (correctly) rollback will rollback the most recently applied migration, which can be a deferred one that is some distance up the list. This is surprising.

~Two~Three possible fixes:

  1. require --run-deferred for rollbacks as well
  2. if about to rollback a deferred rollback, prompt for a confirmation
  3. Change list to list in applied order, rather than name order.