Atomic transactions are the backbone of relational databases. ACID-compliant databases like MySQL or Postgres provide some very important properties of data integrity with the help of transactions. This essentially means all statements executed within the scope of a single transaction are either all successfully executed or the entire block is rolled back.

In my previous two articles, we have learned about the basics of Sequelize and Sequelize associations. In this last post, we will learn about transactions in Sequelize.

Sequelize supports two ways of using transactions:

  1. Unmanaged transactions
  2. Managed transactions

Unmanaged transactions:

Committing and rolling back the transaction should be done manually by the user by calling the Sequelize transaction.commit() & transaction.rollback() methods.

#javascript

How to Sequelize Transactions
2.95 GEEK