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

You need to sign in or sign up before continuing.
Commit 6a280a67 by Mick Hansen

fix(postgres/query-generator): addColumn should replace BOOLEAN type correctly

1 parent 13a37d70
......@@ -392,7 +392,7 @@ module.exports = (function() {
}
var template = '<%= type %>'
, replacements = { type: attribute.type };
, replacements = {};
if (attribute.type.toString() === DataTypes.ENUM.toString()) {
if (Array.isArray(attribute.values) && (attribute.values.length > 0)) {
......@@ -404,15 +404,19 @@ module.exports = (function() {
}
}
if (attribute.type === attribute.BOOLEAN) {
if (attribute.type === DataTypes.BOOLEAN) {
attribute.type = 'BOOLEAN';
}
if (attribute.type === attribute.DATE) {
if (attribute.type === DataTypes.DATE) {
attribute._typeName = 'DATETIME';
attribute.type = 'TIMESTAMP WITH TIME ZONE';
}
if (!replacements.type) {
replacements.type = attribute.type;
}
if (attribute.hasOwnProperty('allowNull') && (!attribute.allowNull)) {
template += ' NOT NULL';
}
......
......@@ -268,7 +268,9 @@ describe(Support.getTestDialectTeaser("Migrator"), function() {
this.init({ from: 20111117063700, to: 20111205167000 }, function(migrator) {
migrator.migrate().complete(function(err) {
expect(err).not.to.be.ok;
self.sequelize.getQueryInterface().describeTable('User').complete(function(err, data) {
expect(err).not.to.be.ok;
var signature = data.signature
, isAdmin = data.isAdmin
, shopId = data.shopId
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!