updateOrCreate assumes numeric primary key(s)

I removed the check to see if a property is an ID field while building the
values clause to allow it to work if primary key(s) are strings.
This commit is contained in:
Scott Anderson 2014-04-16 16:37:28 -04:00
parent 3f62731d02
commit 0a619fb263
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)) { if (props[key] || mysql.id(model, key)) {
var k = mysql.columnEscaped(model, key); var k = mysql.columnEscaped(model, key);
var v; var v;
if (!mysql.id(model, key)) { v = mysql.toDatabase(props[key], data[key]);
v = mysql.toDatabase(props[key], data[key]);
} else {
v = data[key];
}
if (v !== undefined) { if (v !== undefined) {
fieldsNames.push(k); fieldsNames.push(k);
fieldValues.push(v); fieldValues.push(v);