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

Commit 7849eda0 by Jeff French

Fix addColumn query generation for enums in postgres.

1 parent 30c1c32e
Showing with 3 additions and 4 deletions
...@@ -175,17 +175,16 @@ module.exports = (function() { ...@@ -175,17 +175,16 @@ module.exports = (function() {
addColumnQuery: function(table, key, dataType) { addColumnQuery: function(table, key, dataType) {
var query = 'ALTER TABLE <%= table %> ADD COLUMN <%= attribute %>;' var query = 'ALTER TABLE <%= table %> ADD COLUMN <%= attribute %>;'
, dbDataType = this.attributeToSQL(dataType, {context: 'addColumn'})
, attribute; , attribute;
if (dataType.toString() === DataTypes.ENUM.toString()) { if ((dataType.type && dataType.type.toString() === DataTypes.ENUM.toString()) || dataType.toString() === DataTypes.ENUM.toString()) {
query = this.pgEnum(table, key, dataType) + query; query = this.pgEnum(table, key, dataType) + query;
} }
attribute = Utils._.template('<%= key %> <%= definition %>')({ attribute = Utils._.template('<%= key %> <%= definition %>')({
key: this.quoteIdentifier(key), key: this.quoteIdentifier(key),
definition: this.attributeToSQL(dataType, { definition: this.pgDataTypeMapping(table, key, dbDataType)
context: 'addColumn'
})
}); });
return Utils._.template(query)({ return Utils._.template(query)({
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!