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:
parent
3f62731d02
commit
0a619fb263
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue