diff --git a/lib/adapters/mysql.js b/lib/adapters/mysql.js index bdfb6cca..563559f2 100644 --- a/lib/adapters/mysql.js +++ b/lib/adapters/mysql.js @@ -66,7 +66,17 @@ 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])); + if(key.indexOf('.') != -1) { + keys = key.split('.'); + + for(var item = 0; item < keys.length; item++) { + keys[item] = '`' + keys[item] + '`'; + } + + key = keys.join('.'); + } + + fields.push('`' + key + '` = ' + this.toDatabase(props[key], data[key])); } }.bind(this)); return fields.join(',');