diff --git a/lib/adapters/mysql.js b/lib/adapters/mysql.js index bdfb6cca..72639242 100644 --- a/lib/adapters/mysql.js +++ b/lib/adapters/mysql.js @@ -66,7 +66,7 @@ MySQL.prototype.toFields = function (model, data) { var props = this._models[model].properties; Object.keys(data).forEach(function (key) { if (props[key]) { - fields.push(key + ' = ' + this.toDatabase(props[key], data[key])); + fields.push('`' + key.replace(/\./g, '`.`') + '` = ' + this.toDatabase(props[key], data[key])); } }.bind(this)); return fields.join(','); @@ -90,6 +90,7 @@ MySQL.prototype.toDatabase = function (prop, val) { ].join('-'); return this.client.escape(val); } + if (prop.type.name == "Boolean") return val ? 1 : 0; return this.client.escape(val.toString()); };