Merge pull request #642 from rus0000/rus0000-patch-1-fix-updateOrCreate-transaction

Fix updateOrCreate transaction propagation
This commit is contained in:
Raymond Feng 2015-07-02 10:17:12 -07:00
commit 506abf134e
1 changed files with 5 additions and 1 deletions

View File

@ -532,7 +532,11 @@ DataAccessObject.updateOrCreate = DataAccessObject.upsert = function upsert(data
}
});
} else {
Model.findOne({ where: ctx.query.where }, { notify: false }, function (err, inst) {
var opts = {notify: false};
if (ctx.options && ctx.options.transaction) {
opts.transaction = ctx.options.transaction;
}
Model.findOne({where: ctx.query.where}, opts, function (err, inst){
if (err) {
return cb(err);
}