From 17cac79b09d4ea1a3ae1fabe17fd7062e8b43824 Mon Sep 17 00:00:00 2001 From: Rus1 Date: Tue, 23 Jun 2015 19:14:36 +0300 Subject: [PATCH] Fix updateOrCreate transaction propagation --- lib/dao.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/dao.js b/lib/dao.js index 964c8be9..27838822 100644 --- a/lib/dao.js +++ b/lib/dao.js @@ -505,7 +505,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); }