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

You need to sign in or sign up before continuing.
Commit 34e89295 by Sascha Depold

added transaction support

1 parent e70d354f
Showing with 14 additions and 4 deletions
...@@ -50,12 +50,17 @@ module.exports = (function() { ...@@ -50,12 +50,17 @@ module.exports = (function() {
}).run() }).run()
} }
QueryInterface.prototype.showAllSchemas = function() { QueryInterface.prototype.showAllSchemas = function(options) {
var self = this var self = this
options = Utils._.extend({
transaction: null,
raw: true
}, options || {})
return new Utils.CustomEventEmitter(function(emitter) { return new Utils.CustomEventEmitter(function(emitter) {
var showSchemasSql = self.QueryGenerator.showSchemasQuery() var showSchemasSql = self.QueryGenerator.showSchemasQuery()
self.sequelize.query(showSchemasSql, null, { raw: true }).success(function(schemaNames) { self.sequelize.query(showSchemasSql, null, options).success(function(schemaNames) {
self.emit('showAllSchemas', null) self.emit('showAllSchemas', null)
emitter.emit('success', Utils._.flatten(Utils._.map(schemaNames, function(value){ return (!!value.schema_name ? value.schema_name : value) }))) emitter.emit('success', Utils._.flatten(Utils._.map(schemaNames, function(value){ return (!!value.schema_name ? value.schema_name : value) })))
}).error(function(err) { }).error(function(err) {
...@@ -278,13 +283,18 @@ module.exports = (function() { ...@@ -278,13 +283,18 @@ module.exports = (function() {
return queryAndEmit.call(this, sql, 'renameTable') return queryAndEmit.call(this, sql, 'renameTable')
} }
QueryInterface.prototype.showAllTables = function() { QueryInterface.prototype.showAllTables = function(options) {
var self = this var self = this
options = Utils._.extend({
transaction: null,
raw: true
}, options || {})
return new Utils.CustomEventEmitter(function(emitter) { return new Utils.CustomEventEmitter(function(emitter) {
var showTablesSql = self.QueryGenerator.showTablesQuery() var showTablesSql = self.QueryGenerator.showTablesQuery()
self.sequelize.query(showTablesSql, null, { raw: true }).success(function(tableNames) { self.sequelize.query(showTablesSql, null, options).success(function(tableNames) {
self.emit('showAllTables', null) self.emit('showAllTables', null)
emitter.emit('success', Utils._.flatten(tableNames)) emitter.emit('success', Utils._.flatten(tableNames))
}).error(function(err) { }).error(function(err) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!