knex-migrate icon indicating copy to clipboard operation
knex-migrate copied to clipboard

Document differences from knex's implementation

Open carlbennettnz opened this issue 7 years ago • 3 comments

I just spent waaaaay too long discovering that knex migrate:latest runs multiple migrations in one transaction, while knex-migrate up will run each migration in a single transaction. This library also seems to ignore exports.config.transaction. Are there other small differences like this? Could we add a section to the README documenting them?

carlbennettnz avatar Feb 08 '18 21:02 carlbennettnz

Yes, do you want to write this section?

sheerun avatar Mar 26 '18 19:03 sheerun

I could write up the two I mentioned. Do you know of any others?

carlbennettnz avatar Mar 26 '18 21:03 carlbennettnz

When I implemented this library this seemed to be the most offending difference, but this is just how https://github.com/sequelize/umzug works. Personally I think this is better choice because each migration should be independent so it shouldn't matter if you run multiple migrations in transaction or not, and wrapping each migration in transaction makes it more probable for all migrations to pass. Maybe I'm missing something though.

As for disabling transactions this is missing feature that can be implemented, it seems that umzug passes whole migration as this argument: https://github.com/sequelize/umzug/blob/master/src/migration.js#L115 this could be used here to conditionally apply transaction: https://github.com/sheerun/knex-migrate/blob/master/src/index.js#L111-L117

You could mention this comment when mentioning that there's no support for disabling transactions. For near future I won't have time to implement it.

sheerun avatar Mar 26 '18 22:03 sheerun