Creates a new transaction instance
A configured sequelize Instance
An object with options
Same as Transaction.LOCK, but can also be called on instances of transactions to get possible options for row locking directly from the instance.
Isolation levels can be set per-transaction by passing options.isolationLevel
to sequelize.transaction
.
Sequelize uses the default isolation level of the database, you can override this by passing options.isolationLevel
in Sequelize constructor options.
Pass in the desired level as the first argument:
Possible options for row locking. Used in conjunction with find
calls:
possible options for row locking
Types can be set per-transaction by passing options.type
to sequelize.transaction
.
Default to DEFERRED
but you can override the default type by passing options.transactionType
in new Sequelize
.
Sqlite only.
Pass in the desired level as the first argument:
Adds a hook that is run after a transaction is committed.
A callback function that is called with the committed transaction
Commit the transaction.
Called to acquire a connection to use and set the correct options on the connection.
We should ensure all of the environment that's set up is cleaned up in cleanup()
below.
Defaults to true: Use CLS (Continuation Local Storage) with Sequelize. With CLS, all queries within the transaction callback will automatically receive the transaction object.
Rollback (abort) the transaction
Generated using TypeDoc
The transaction object is used to identify a running transaction. It is created by calling
Sequelize.transaction()
. To run a query under a transaction, you should pass the transaction in the options object.{Sequelize.transaction}