Merge pull request #19 from vectart/master
Prevent inserting undefined values
This commit is contained in:
commit
f6a370921d
10
lib/mysql.js
10
lib/mysql.js
|
@ -215,9 +215,13 @@ MySQL.prototype.updateOrCreate = function (model, data, callback) {
|
|||
} else {
|
||||
v = data[key];
|
||||
}
|
||||
fieldsNames.push(k);
|
||||
fieldValues.push(v);
|
||||
if (!mysql.id(model, key)) combined.push(k + ' = ' + v);
|
||||
if (v !== undefined) {
|
||||
fieldsNames.push(k);
|
||||
fieldValues.push(v);
|
||||
if (!mysql.id(model, key)) {
|
||||
combined.push(k + ' = ' + v);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue