6

Implementing Transactions with Sequelize

Throughout the previous chapters, we went over how to ensure that data integrity is maintained from within our Node.js application using life cycle events, validations, and constraints. However, these methods do not guarantee that the data is internally consistent in the database itself. Databases offer a way to atomicize integrity using transactions.

Transactions are used for ensuring a process has been completed without interruptions such as a connection failure or the power abruptly failing. They are also used for isolating, or locking, applications from manipulating data concurrently, which alleviates race condition issues. Transactions promise data validity by following the ACID principle, which ...

Get Supercharging Node.js Applications with Sequelize now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.