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

Commit 3034461b by Daniel Durante

Forgot to check for DAOFactoryManager in DAOFactoryManager.drop() for the dialec…

…t when declaring tableName.
1 parent fb37f064
Showing with 5 additions and 2 deletions
......@@ -207,7 +207,8 @@ module.exports = (function() {
DAOFactory.prototype.drop = function(options) {
// Only Postgres' QueryGenerator.dropTableQuery() will add schema manually
var tableName = !!options && !!options.schema && this.options.dialect === "postgres" ? this.tableName : this.getTableName()
var isPostgres = this.options.dialect === "postgres" || (!!this.daoFactoryManager && this.daoFactoryManager.sequelize.options.dialect === "postgres")
, tableName = isPostgres ? this.tableName : this.getTableName()
return this.QueryInterface.dropTable(tableName, options)
}
......
......@@ -194,13 +194,15 @@ module.exports = (function() {
// Just in case if we're trying to drop a non-existing table
daoTable = daoTable.length > 0 ? daoTable[0] : null
if (!!daoTable) {
var getTableName = (!options || !options.schema || options.schema === "public" ? '' : options.schema + '_') + tableName
var keys = Object.keys(daoTable.rawAttributes)
, keyLen = keys.length
, i = 0
for (i = 0; i < keyLen; i++) {
if (daoTable.rawAttributes[keys[i]].type && daoTable.rawAttributes[keys[i]].type === "ENUM") {
chainer.add(self.sequelize, 'query', [self.QueryGenerator.pgEnumDrop(tableName, keys[i]), null, {raw: true}])
chainer.add(self.sequelize, 'query', [self.QueryGenerator.pgEnumDrop(getTableName, keys[i]), null, {raw: true}])
}
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!