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

Commit 505c24cd by sdepold

minor refactoring

1 parent 091a4a24
Showing with 10 additions and 1 deletions
...@@ -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!