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

Commit 505c24cd by sdepold

minor refactoring

1 parent 091a4a24
Showing with 11 additions and 2 deletions
...@@ -26,7 +26,7 @@ module.exports = (function() { ...@@ -26,7 +26,7 @@ module.exports = (function() {
var ConnectorManager = require("./dialects/" + this.options.dialect + "/connector-manager") var ConnectorManager = require("./dialects/" + this.options.dialect + "/connector-manager")
this.modelManager = new ModelManager(this) this.modelManager = new ModelManager(this)
this.connectorManager = new ConnectorManager(this, this.config) this.connectorManager = new ConnectorManager(this, this.config)
} }
...@@ -38,6 +38,15 @@ module.exports = (function() { ...@@ -38,6 +38,15 @@ module.exports = (function() {
return this.queryInterface return this.queryInterface
} }
Sequelize.prototype.getMigrator = function(options, force) {
if(force)
this.migrator = new Migrator(this, options)
else
this.migrator = this.migrator || new Migrator(this, options)
return this.migrator
}
Sequelize.prototype.define = function(modelName, attributes, options) { Sequelize.prototype.define = function(modelName, attributes, options) {
options = options || {} options = options || {}
...@@ -57,7 +66,7 @@ module.exports = (function() { ...@@ -57,7 +66,7 @@ module.exports = (function() {
} }
Sequelize.prototype.migrate = function(options) { Sequelize.prototype.migrate = function(options) {
new Migrator(this, options).migrate() this.getMigrator().migrate(options)
} }
Sequelize.prototype.query = function(sql, callee, options) { Sequelize.prototype.query = function(sql, callee, options) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!