Fix issue with incorrect migrations in SequelizeMeta getting deleted when reverting #396

Merged
merged 3 commits into from Jan 15, 2013

Projects

None yet

2 participants

@shaunrader

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).

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.

@sdepold
sequelize member

thank you :) will check it out

@shaunrader

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;

@sdepold sdepold merged commit 60ebce1 into sequelize:master Jan 15, 2013

1 check failed

Details default The Travis build failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment