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

Commit 5cd59bc0 by Sascha Gehlich

Moved normalizing of attribute.values to DaoFactory#define

1 parent 9dd74200
......@@ -292,12 +292,6 @@ module.exports = (function() {
if (Utils.isHash(dataType)) {
var template
// We have special cases where the type is an object containing
// the values (e.g. Sequelize.ENUM(value, value2) returns an object
// instead of a function)
// Copy these values to the dataType
dataType.values = dataType.type.values || dataType.values;
if (dataType.type.toString() === DataTypes.ENUM.toString()) {
if (Array.isArray(dataType.values) && (dataType.values.length > 0)) {
template = "ENUM(" + Utils._.map(dataType.values, function(value) {
......
......@@ -203,6 +203,13 @@ module.exports = (function() {
// If you don't specify a valid data type lets help you debug it
Utils._.each(attributes, function(dataType, name) {
if (Utils.isHash(dataType)) {
// We have special cases where the type is an object containing
// the values (e.g. Sequelize.ENUM(value, value2) returns an object
// instead of a function)
// Copy these values to the dataType
dataType.values = (dataType.type && dataType.type.values) || dataType.values;
// We keep on working with the actual type object
dataType = dataType.type
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!