This fixes two scenarios (tested in PostgreSQL and SQLite):
1) When performing one off migrations using sequelize -m after each new migration if you revert a migration using sequelize -m -u the earliest record in the SequelizeMeta table gets deleted instead of the latest record (which corresponds to the reverted migration).
sequelize -m -u
2) When performing multiple migrations using sequelize -m if you revert the multiple migrations using sequelize -m -u the earliest records in the SequelizeMeta table get deleted instead of the latest records (ie if 2 migrations were reverted the earliest 2 will be deleted instead of the last 2 corresponding to the reverted migrations).
Both of these scenarios are apparent when trying to run sequelize -m again after sequelize -m -u to re-run the reverted migration(s) since the SequelizeMeta table shows the latest script has been run.
Fix issue with incorrect migration in SequelizeMeta being deleted whe…
…n reverting last successful migration
Fix issue with incorrect migrations in SequelizeMeta being deleted wh…
…en reverting multiple migrations
thank you :) will check it out
fixed issue with from and to migration ids not including single quote…
…s around them in where clause
I noticed sequelize -m -u was not working in PostgreSQL due to missing single quotes around the migration from and to values. This should be fixed with latest commit. Thanks for the great library!
SELECT * FROM "SequelizeMeta" WHERE "from"='20130109211147' AND "to"='20130109211147' LIMIT 1;