Skip to content

Instantly share code, notes, and snippets.

@greyscaled
Created June 2, 2018 03:22
Show Gist options
  • Save greyscaled/b15fa67fdc1581fd8ed63a81ebc2608e to your computer and use it in GitHub Desktop.
Save greyscaled/b15fa67fdc1581fd8ed63a81ebc2608e to your computer and use it in GitHub Desktop.
let transaction
try {
// Unmanaged Transaction
transaction = await sequelize.transaction()
// make sure to use the transaction in options
await Team.create({...},{transaction})
// always call commit at the end
await transaction.commit()
} catch (err) {
// always rollback
await transaction.rollback()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment