From 789d1de9e0d2e2b4a638126f9ad1368938e8aa0b Mon Sep 17 00:00:00 2001 From: Kelvin Del Monte Date: Thu, 14 Jul 2016 07:56:24 -0400 Subject: [PATCH] Fix issue were insert would break if the PK was a GUID due to the adapter adding an SET IDENTITY_INSERT clause which should only be used with integer PKs --- lib/adapter.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/adapter.js b/lib/adapter.js index b5738d6..df4c43a 100644 --- a/lib/adapter.js +++ b/lib/adapter.js @@ -382,8 +382,11 @@ module.exports = (function () { Object.keys(values).forEach(function(key) { values[key] = utils.prepareValue(values[key]); if (pk == key && pk == 'id') { - identityInsert = true; - //console.log(pk, '==', key); + var type = connections[connection].collections[collection].definition['id'].type; + if(type === 'number'){ + identityInsert = true; + //console.log(pk, '==', key); + } } }); var schemaName = getSchemaName(connection, collection);