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

Commit 61e1cfe9 by Jan Aagaard Meier

Merge pull request #3833 from overlookmotel/fix-logging-passing

Fix `options.logging` not being passed to queries
2 parents ddf90b01 6b9c9741
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
- [FIXED] Fix an issue where include all was not being properly expanded for self-references [#3804](https://github.com/sequelize/sequelize/issues/3804) - [FIXED] Fix an issue where include all was not being properly expanded for self-references [#3804](https://github.com/sequelize/sequelize/issues/3804)
- [FIXED] Fix instance.changed regression to not return false negatives for not changed null values [#3812](https://github.com/sequelize/sequelize/issues/3812) - [FIXED] Fix instance.changed regression to not return false negatives for not changed null values [#3812](https://github.com/sequelize/sequelize/issues/3812)
- [FIXED] Fix isEmail validator to allow args: true [#3770](https://github.com/sequelize/sequelize/issues/3770) - [FIXED] Fix isEmail validator to allow args: true [#3770](https://github.com/sequelize/sequelize/issues/3770)
- [FIXED] Fix some occasions where `options.logging` was not used correctly
- [FIXED] Fix `Model#destroy()` to correctly use `options.transaction`
# 3.1.1 # 3.1.1
- [FIXED] Always quote aliases, even when quoteIdentifiers is false [#1589](https://github.com/sequelize/sequelize/issues/1589) - [FIXED] Always quote aliases, even when quoteIdentifiers is false [#1589](https://github.com/sequelize/sequelize/issues/1589)
......
...@@ -167,6 +167,7 @@ module.exports = (function() { ...@@ -167,6 +167,7 @@ module.exports = (function() {
if ((fieldsOrOptions || {}).transaction instanceof Transaction) { if ((fieldsOrOptions || {}).transaction instanceof Transaction) {
options.transaction = fieldsOrOptions.transaction; options.transaction = fieldsOrOptions.transaction;
} }
options.logging = (fieldsOrOptions || {}).logging;
return association.target.create(values, fieldsOrOptions).then(function(newAssociatedObject) { return association.target.create(values, fieldsOrOptions).then(function(newAssociatedObject) {
return instance[association.accessors.set](newAssociatedObject, options); return instance[association.accessors.set](newAssociatedObject, options);
......
...@@ -257,7 +257,8 @@ module.exports = (function() { ...@@ -257,7 +257,8 @@ module.exports = (function() {
return instance[association.accessors.get]({ return instance[association.accessors.get]({
where: newInstance.where(), where: newInstance.where(),
scope: false, scope: false,
transaction: options.transaction transaction: options.transaction,
logging: options.logging
}).bind(this).then(function(currentAssociatedObjects) { }).bind(this).then(function(currentAssociatedObjects) {
if (currentAssociatedObjects.length === 0) { if (currentAssociatedObjects.length === 0) {
newInstance.set(association.identifier, instance.get(instance.Model.primaryKeyAttribute)); newInstance.set(association.identifier, instance.get(instance.Model.primaryKeyAttribute));
......
...@@ -1483,7 +1483,7 @@ module.exports = (function() { ...@@ -1483,7 +1483,7 @@ module.exports = (function() {
}).then(function() { }).then(function() {
// Get daos and run beforeDestroy hook on each record individually // Get daos and run beforeDestroy hook on each record individually
if (options.individualHooks) { if (options.individualHooks) {
return self.findAll({where: options.where, transaction: options.transaction}).map(function(instance) { return self.findAll({where: options.where, transaction: options.transaction, logging: options.logging}).map(function(instance) {
return self.runHooks('beforeDestroy', instance, options).then(function() { return self.runHooks('beforeDestroy', instance, options).then(function() {
return instance; return instance;
}); });
...@@ -1555,7 +1555,7 @@ module.exports = (function() { ...@@ -1555,7 +1555,7 @@ module.exports = (function() {
}).then(function() { }).then(function() {
// Get daos and run beforeDestroy hook on each record individually // Get daos and run beforeDestroy hook on each record individually
if (options.individualHooks) { if (options.individualHooks) {
return self.findAll({where: options.where}, {transaction: options.transaction}).map(function(instance) { return self.findAll({where: options.where, transaction: options.transaction, logging: options.logging}).map(function(instance) {
return self.runHooks('beforeRestore', instance, options).then(function() { return self.runHooks('beforeRestore', instance, options).then(function() {
return instance; return instance;
}); });
...@@ -1681,7 +1681,7 @@ module.exports = (function() { ...@@ -1681,7 +1681,7 @@ module.exports = (function() {
// Get instances and run beforeUpdate hook on each record individually // Get instances and run beforeUpdate hook on each record individually
if (options.individualHooks) { if (options.individualHooks) {
return self.findAll({where: options.where, transaction: options.transaction}).then(function(_instances) { return self.findAll({where: options.where, transaction: options.transaction, logging: options.logging}).then(function(_instances) {
instances = _instances; instances = _instances;
if (!instances.length) { if (!instances.length) {
return []; return [];
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!