不要怂,就是干,撸起袖子干!

Commit 977d6262 by Sascha Depold

Apply allowNull even if column is a primaryKey

1 parent 3a40d1c9
Showing with 3 additions and 3 deletions
...@@ -38,8 +38,8 @@ module.exports = (function() { ...@@ -38,8 +38,8 @@ module.exports = (function() {
var query = 'CREATE TABLE IF NOT EXISTS <%= table %> (<%= attributes%>)' var query = 'CREATE TABLE IF NOT EXISTS <%= table %> (<%= attributes%>)'
, primaryKeys = [] , primaryKeys = []
, needsMultiplePrimaryKeys = (Utils._.values(attributes).filter(function(definition) { , needsMultiplePrimaryKeys = (Utils._.values(attributes).filter(function(definition) {
return Utils._.includes(definition, 'PRIMARY KEY'); return Utils._.includes(definition, 'PRIMARY KEY');
}).length > 1) }).length > 1)
, attrStr = [] , attrStr = []
, modifierLastIndex = -1; , modifierLastIndex = -1;
...@@ -276,7 +276,7 @@ module.exports = (function() { ...@@ -276,7 +276,7 @@ module.exports = (function() {
} }
} }
if (dataType.hasOwnProperty('allowNull') && !dataType.allowNull && !dataType.primaryKey) { if (dataType.hasOwnProperty('allowNull') && !dataType.allowNull) {
template += " NOT NULL"; template += " NOT NULL";
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!