sequelize/sequelize — pull request #2544 by peaches (2014-11-07 08:04:39+00:00)
Title: Fixing downward migration issue

When running db:migrate:undo from sequelize-cli, it does not undo the
last migration done, but undoes all migrations. This bug effectively
wipes out your entire database. Even worse, it only deletes the last
batch of migration, so it leaves data in SequelizeMeta which will
likely cause future migrations to fail. The only workaround is to this
last issue is to clear out the SequelizeMeta table and start fresh.
Additional changes in this commit are:

- Refactors existing copied-pasted code into a common function
- Remove deprecated code path and change test to point to the correct version
- Add test case that would prevent the behavior in the future

@chrisatsc also noted this same behavior at
https://github.com/sequelize/cli/issues/58#issuecomment-60618456

Side effect of this change is that anyone who's coded against
`getUndoneMigrations` to get the last batch of migrations will have
to call into `getCompletedMigrations` instead. The signature should
be identical.