I am working with Sequelize transaction and would like to know how to do a bulk update before sequentially doing a bulk create.
My current code is something like this:
return sequelize.transaction(function(t){
return sequelize.Promise.each(arrToUpdate, function(itemToUpdate){
model.update(itemToUpdate, { transaction: t })
});
//How to do a sequential bulk create after the bulk update is successful in sequelize
//transaction?
//Bulk Create code would be return model.bulkCreate(itemsArray, { transaction: t })
});
via Chua Bing Quan
No comments:
Post a Comment