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

Commit e6ddc697 by Mick Hansen

Merge pull request #5226 from sushantdhiman/fix-5092

Fix 5092
2 parents ad124e3b 27d2426a
# FUTURE
# Future
- [ADDED] Support silent: true in bulk update [#5200](https://github.com/sequelize/sequelize/issues/5200)
- [FIXED] Postgres destroy with `where` fails on JSONB data [#5092](https://github.com/sequelize/sequelize/issues/5092)
# 3.17.3
- [FIXED] Regression with array values from security fix in 3.17.2
......
......@@ -375,7 +375,7 @@ var QueryGenerator = {
var replacements = {
table: this.quoteIdentifiers(tableName),
where: this.getWhereConditions(where),
where: this.getWhereConditions(where, null, model, options),
limit: !!options.limit ? ' LIMIT ' + this.escape(options.limit) : '',
primaryKeys: primaryKeys[tableName].length > 1 ? '(' + pks + ')' : pks,
primaryKeysSelection: pks
......
......@@ -310,6 +310,53 @@ describe(Support.getTestDialectTeaser('Model'), function() {
});
});
});
it('should be possible to destroy with where', function () {
var conditionSearch = {
where: {
data: {
employment : 'Hacker'
}
}
};
return Promise.join(
this.Event.create({
data: {
name: {
first: 'Elliot',
last: 'Alderson'
},
employment: 'Hacker'
}
}),
this.Event.create({
data: {
name: {
first: 'Christian',
last: 'Slater'
},
employment: 'Hacker'
}
}),
this.Event.create({
data: {
name: {
first: ' Tyrell',
last: 'Wellick'
},
employment: 'CTO'
}
})
).bind(this).then(function () {
return expect(this.Event.findAll(conditionSearch)).to.eventually.have.length(2);
}).then(function() {
return this.Event.destroy(conditionSearch);
}).then(function(){
return expect(this.Event.findAll(conditionSearch)).to.eventually.have.length(0);
});
});
});
}
});
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!