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 {
|
} else {
|
||||||
v = data[key];
|
v = data[key];
|
||||||
}
|
}
|
||||||
fieldsNames.push(k);
|
if (v !== undefined) {
|
||||||
fieldValues.push(v);
|
fieldsNames.push(k);
|
||||||
if (!mysql.id(model, key)) combined.push(k + ' = ' + v);
|
fieldValues.push(v);
|
||||||
|
if (!mysql.id(model, key)) {
|
||||||
|
combined.push(k + ' = ' + v);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue