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

Commit 0968f43b by Matt Broadstone

fix addColumnQuery for ENUM types

There a whole bunch wrong here, but mostly with sequelize. First and
foremost attributeToSQL (the convention) should be working with attributes,
however it's using dataTypes here because.. well every other dialect does
this too. addColumnQuery as defined in the abstract QueryGenerator class
says you should be using attributes, but everyone else uses (key, dataType).
This is a kludge to make ENUMs work for TSQL, since it needs to know the
field name to generate the SQL
1 parent 32d2374a
Showing with 4 additions and 0 deletions
......@@ -93,6 +93,10 @@ module.exports = (function() {
},
addColumnQuery: function(tableName, key, dataType) {
// FIXME: attributeToSQL SHOULD be using attributes in addColumnSql
// but instead we need to pass the key along as the field here
dataType.field = key;
var query = [
SqlGenerator.alterTableSql(tableName),
SqlGenerator.addColumnSql(key, dataType)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!