How to create a sequelize transaction

According to the Sequelize documentation, it looks like the where clause and the transaction should be in the same object.

Could you replace:

await myCovers.update({ refunded: amount }, { where: { id } }, { transaction });
// update number 2
await myCovers.update({ refunded: amount }, { where: { id2 } }, { transaction });

by

await myCovers.update({ refunded: amount }, { where: { id }, transaction });
// update number 2
await myCovers.update({ refunded: amount }, { where: { id2 }, transaction });

Tell me if it helps :slight_smile:

1 Like