Search code examples
node.jsdatabasetransactionssequelize.jsmigration

Transactions between migrations in sequelize


For example i've got 3 migrations file. i know how to use transactions inside migrations, but how can create transaction in first file of migration and commit it in the last. is there any configs or i have to use CLS?


Solution

  • Sequelize does not support having a transaction that spans multiple migrations. If you want that behaviour you should include everything in one migration (since one migration represents an atomic operation) and use a transaction.