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

Commit 9ad93d24 by Eric Thompson

Pulled changes in from sequelize:master

2 parents c1fc0fa9 eca0a902
# FUTURE
# Future
- [ADDED] Support silent: true in bulk update [#5200](https://github.com/sequelize/sequelize/issues/5200)
- [ADDED] `retry` object now part of global settings and can be overridden per call. The default is 5 retries with a backoff function. `retry` object can be passed to options with max: 0 to turn off this behavior.
- [ADDED] Sqlite now retries database queries that return SQL_BUSY as the status.
- [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
......
......@@ -303,9 +303,7 @@ Query.prototype.formatError = function (err) {
case '23505':
// there are multiple different formats of error messages for this error code
// this regex should check at least two
match = errDetail.replace(/"/g, '').match(/Key \((.*?)\)=\((.*?)\)/);
if (match) {
if (errDetail && (match = errDetail.replace(/"/g, '').match(/Key \((.*?)\)=\((.*?)\)/))) {
fields = _.zipObject(match[1].split(', '), match[2].split(', '));
errors = [];
message = 'Validation error';
......
......@@ -50,7 +50,7 @@
"wkx": "0.2.0"
},
"devDependencies": {
"babel-core": "^6.2.0",
"babel-core": "^6.4.5",
"babel-preset-es2015": "^6.1.18",
"chai": "^3.0.0",
"chai-as-promised": "^5.1.0",
......
......@@ -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!