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

Migrations started with knex_migrate do not have '_lock' table #40

Open
mashaalmemon opened this issue Dec 12, 2018 · 4 comments
Open

Comments

@mashaalmemon
Copy link

Using knex when a migration is performed for the first type typically we'll get two tables created automatically by knex:

migrations
migrations_lock

However when using knex-migrate, and stepping forward a specific number of 'step' only one table is created, not the 'lock' table:

migrations

Any idea why this is happening? I have knex 0.15.2 installed in my environment. I am using a postgresql database.

@mashaalmemon
Copy link
Author

Anyone maintaining this project?

@sheerun
Copy link
Owner

sheerun commented Dec 22, 2018

Why do you need _lock table?

@hudsonma
Copy link

hudsonma commented Feb 5, 2019

My project was bit by this too. If knex-migrate is tied into application startup, and you have more than one instance of your application, then you create a potential race condition on the execution of migrations. Having a lock table ensures only one instance can make database changes at a time, guaranteeing execution in the proper order and no duplication.

We are going to get around this by adding a pre-deployment hook to execute the migrations from a single process, but I think if this library is going to tout 100% compatibility with knex, then the lock tables need to be created. If not, there should be a disclaimer section containing all the features not supported from knex.

@sheerun
Copy link
Owner

sheerun commented Mar 11, 2019

I'd accept PR fixing this

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

No branches or pull requests

3 participants