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

Commit cfdd50a8 by Jan Aagaard Meier

Add toString before replacing special characters in query generator. Closes #3048

1 parent d170b5da
...@@ -243,7 +243,7 @@ module.exports = (function() { ...@@ -243,7 +243,7 @@ module.exports = (function() {
value = this.escape(value, (modelAttributeMap && modelAttributeMap[key]) || undefined); value = this.escape(value, (modelAttributeMap && modelAttributeMap[key]) || undefined);
if (options.exception) { if (options.exception) {
// $ inside value strings are illegal when using $$ as literal strings/delimiters for function bodys // $ inside value strings are illegal when using $$ as literal strings/delimiters for function bodys
value = value.replace(/\$/g, '\\$'); value = value.toString().replace(/\$/g, '\\$');
} }
values.push(value); values.push(value);
} }
......
...@@ -130,6 +130,27 @@ describe(Support.getTestDialectTeaser('Model'), function() { ...@@ -130,6 +130,27 @@ describe(Support.getTestDialectTeaser('Model'), function() {
}); });
}); });
it('should support bools in defaults', function () {
var User = this.sequelize.define('user', {
objectId: {
type: DataTypes.INTEGER,
unique: true
},
bool: DataTypes.BOOLEAN
});
return User.sync({force: true}).then(function () {
return User.findOrCreate({
where: {
objectId: 1
},
defaults: {
bool: false
}
});
});
});
it('returns instance if already existent. Single find field.', function(done) { it('returns instance if already existent. Single find field.', function(done) {
var self = this, var self = this,
data = { data = {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!