node-sql-migrations
node-sql-migrations copied to clipboard
appliedMigrations function not returning migrations in correct order
The statement select * from __migrations__; from pg.js does not return the migrations in the correct order as no order is specified in the postgres command meaning that the results are returned in an unspecified order (docs).
This means that rollbacks are not executed in the order that they were applied. To resolve this the command should be changed to SELECT * FROM __migrations__ ORDER BY id ASC;