From 1f12117ce1ea86cf20c9d8b4fc02b442e8944ed4 Mon Sep 17 00:00:00 2001 From: Herman Klushin Date: Tue, 6 Sep 2016 12:38:40 +0300 Subject: [PATCH 1/2] Primary key can be not autoincrement !!! --- lib/sql.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sql.js b/lib/sql.js index cc2f2a96..d5f4b1e5 100644 --- a/lib/sql.js +++ b/lib/sql.js @@ -83,7 +83,7 @@ var sql = module.exports = { var columnDefinition = attrName + ' ' + type; // If type is an integer, set auto increment - if(type === 'TINYINT' || type === 'SMALLINT' || type === 'INT' || type === 'BIGINT') { + if(!attribute.autoIncrement && (type === 'TINYINT' || type === 'SMALLINT' || type === 'INT' || type === 'BIGINT')) { return columnDefinition + ' UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY'; } From 5373c429ff7b29a6a345868ca6fcde00c3fb1af2 Mon Sep 17 00:00:00 2001 From: Herman Klushin Date: Tue, 6 Sep 2016 12:44:03 +0300 Subject: [PATCH 2/2] Update sql.js --- lib/sql.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sql.js b/lib/sql.js index d5f4b1e5..7288f422 100644 --- a/lib/sql.js +++ b/lib/sql.js @@ -83,7 +83,7 @@ var sql = module.exports = { var columnDefinition = attrName + ' ' + type; // If type is an integer, set auto increment - if(!attribute.autoIncrement && (type === 'TINYINT' || type === 'SMALLINT' || type === 'INT' || type === 'BIGINT')) { + if(attribute.autoIncrement != false && (type === 'TINYINT' || type === 'SMALLINT' || type === 'INT' || type === 'BIGINT')) { return columnDefinition + ' UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY'; }