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

Commit c1ee0836 by sdepold

removed id from dropTable and added dropAllTables

1 parent 74831550
Showing with 25 additions and 2 deletions
......@@ -10,8 +10,31 @@ module.exports = (function() {
return query.call(this, this.QueryGenerator.createTableQuery(tableName, attributes, options))
}
QueryInterface.prototype.dropTable = function(tableName, id) {
return query.call(this, this.QueryGenerator.dropTableQuery(tableName, id))
QueryInterface.prototype.dropTable = function(tableName) {
return query.call(this, this.QueryGenerator.dropTableQuery(tableName))
}
QueryInterface.prototype.dropAllTables = function() {
var self = this
return new Utils.CustomEventEmitter(function(emitter) {
var chainer = new Utils.QueryChainer()
self.sequelize.query('SHOW TABLES;', null, { raw: true }).success(function(data) {
var tableNames = Sequelize.Utils._.map(data, function(hash) {
return Sequelize.Utils._.values(hash)
})
Sequelize.Utils._.flatten(tableNames).forEach(function(tableName) {
chainer.add(self.sequelize.getQueryInterface().dropTable(tableName))
})
chainer
.run()
.success(function() { emitter.emit('success', null) })
.error(function(err) { emitter.emit('failure', err) })
}).error(function(err) {
emitter.emit('failure', err)
})
}).run()
}
QueryInterface.prototype.renameTable = function() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!