Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong Order of Roll-back Migrations #6

Closed
mszymulanski opened this issue Apr 27, 2017 · 2 comments
Closed

Wrong Order of Roll-back Migrations #6

mszymulanski opened this issue Apr 27, 2017 · 2 comments

Comments

@mszymulanski
Copy link

If a set of migrations is executed within the same second, their roll-back may be executed in a wrong order.

I have these migrations in my MySql:

id name batch migration_time
39 20170406171908_mysql_create_table_status_type.js 1 2017-04-26 21:48:34
40 20170406172149_mysql_init_status_type 1 2017-04-26 21:48:34

In my case, the rollback 1st deletes the table, than tries to de-initialize contents of the deleted table, which results in an error.

knex-migrate down --to 0 grabs all the migrations, then orders them by the migration_date. It should order the migrations by their identifiers. Here is the culprit:
https://github.com/sheerun/knex-migrate/blob/master/src/storage.js#L59

@sheerun
Copy link
Owner

sheerun commented Apr 27, 2017

Thank you for noticing this, I've released a fix, could you check?

@mszymulanski
Copy link
Author

It resolved the issue. Thank you, @sheerun !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants