Skip to content

Instantly share code, notes, and snippets.

View bander-saeed94's full-sized avatar
🎯
Focusing

bander-saeed94

🎯
Focusing
  • ELM,stc pay
  • Riyadh, Saudi Arabia
View GitHub Profile
@hoangbits
hoangbits / sequelize transaction await
Last active September 22, 2020 00:42
using await with transaction in sequelize ORM
// get transaction
const transaction = await sequelize.transaction();
try {
// step 1
await Model.destroy({where: {id}}, {transaction});
// step 2
await Model.create({}, {transaction});
// commit