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

Commit 5611a26c by Even Committed by Felix Becker

fix(queryinterface): decrement regression (#7960)


Closes #7810
1 parent cebc3af8
......@@ -685,13 +685,14 @@ class QueryInterface {
return this.sequelize.query(sql, options);
}
decrement(instance, tableName, values, identifier, options) {
const sql = this.QueryGenerator.arithmeticQuery('-', tableName, values, identifier, options, options.attributes);
decrement(model, tableName, values, identifier, options) {
options = Utils.cloneDeep(options);
options = _.clone(options) || {};
const sql = this.QueryGenerator.arithmeticQuery('-', tableName, values, identifier, options, options.attributes);
options.type = QueryTypes.UPDATE;
options.instance = instance;
options.model = model;
return this.sequelize.query(sql, options);
}
......
......@@ -310,6 +310,16 @@ describe(Support.getTestDialectTeaser('Instance'), () => {
});
}
if (current.dialect.supports.returnValues.returning) {
it('supports returning', function() {
return this.User.findById(1).then(user1 => {
return user1.decrement('aNumber', { by: 2 }).then(() => {
expect(user1.aNumber).to.be.equal(-2);
});
});
});
}
it('with array', function() {
const self = this;
return this.User.findById(1).then(user1 => {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!