From 0a619fb26328d469bf24a3683e56fb6d2f691632 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Wed, 16 Apr 2014 16:37:28 -0400 Subject: [PATCH] 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. --- lib/mysql.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/mysql.js b/lib/mysql.js index a026435..e796df7 100644 --- a/lib/mysql.js +++ b/lib/mysql.js @@ -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);