不要怂,就是干,撸起袖子干!

Commit ee2f6f0b by Mick Hansen

fix: pass along logging for nested creation

1 parent 605c1f97
Showing with 3 additions and 3 deletions
...@@ -680,15 +680,15 @@ module.exports = (function() { ...@@ -680,15 +680,15 @@ module.exports = (function() {
// Instances will be updated in place so we can safely treat HasOne like a HasMany // Instances will be updated in place so we can safely treat HasOne like a HasMany
return Promise.map(instances, function (instance) { return Promise.map(instances, function (instance) {
if (include.association instanceof BelongsToMany) { if (include.association instanceof BelongsToMany) {
return instance.save({transaction: options.transaction}).then(function () { return instance.save({transaction: options.transaction, logging: console.log}).then(function () {
var values = {}; var values = {};
values[include.association.foreignKey] = self.get(self.Model.primaryKeyAttribute, {raw: true}); values[include.association.foreignKey] = self.get(self.Model.primaryKeyAttribute, {raw: true});
values[include.association.otherKey] = instance.get(instance.Model.primaryKeyAttribute, {raw: true}); values[include.association.otherKey] = instance.get(instance.Model.primaryKeyAttribute, {raw: true});
return include.association.throughModel.create(values); return include.association.throughModel.create(values, {transaction: t, logging: console.log});
}); });
} else { } else {
instance.set(include.association.identifier, self.get(self.Model.primaryKeyAttribute, {raw: true})); instance.set(include.association.identifier, self.get(self.Model.primaryKeyAttribute, {raw: true}));
return instance.save({transaction: options.transaction}); return instance.save({transaction: options.transaction, logging: console.log});
} }
}); });
}); });
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!