Merge pull request #25 from sra/master

updateOrCreate assumes numeric primary key(s)
This commit is contained in:
Raymond Feng 2014-04-16 15:59:21 -07:00
commit a170621e1c
1 changed files with 1 additions and 5 deletions

View File

@ -213,11 +213,7 @@ MySQL.prototype.updateOrCreate = function (model, data, callback) {
if (props[key] || mysql.id(model, key)) {
var k = mysql.columnEscaped(model, key);
var v;
if (!mysql.id(model, key)) {
v = mysql.toDatabase(props[key], data[key]);
} else {
v = data[key];
}
v = mysql.toDatabase(props[key], data[key]);
if (v !== undefined) {
fieldsNames.push(k);
fieldValues.push(v);