Closed
Description
Hi, I just noticed (due to an issue on Bluebird) you've migrated to Bluebird promises. This is great. I've used sequelize before and enjoyed it in a node app, so props on the project.
Looking at the transaction syntax from the API reference - I see:
// we just opened a new connection to the database which is transaction exclusive.
// also we send some first transaction queries to the database.
sequelize.transaction(function(t) {
// do some async stuff ...
// if everything is ok ... commit the transaction
t.commit().success(function() {})
// if something failed ... rollback the transaction
t.rollback().success(function() {})
// the commit / rollback will emit events which can be observed via:
t.done(function() {
/* we will be here once the transaction
has been committed / reverted */
})
})
What do you think about a more promise oriented approach? Something like the Knex discussion here: knex/knex#265 but in a way that doesn't break the current syntax: by returning to commit and rolling back by rejecting.
(Alternatively, supporting a disposer via the new Bluebird 2 .disposer
and .using
syntax might be helpful for the next time I use sequelize).