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

Commit 7331aab5 by Sascha Depold

Merge pull request #199 from innofluence/importCache

Import cache
2 parents 68fdfc9c 2000687e
Showing with 6 additions and 2 deletions
...@@ -73,9 +73,13 @@ module.exports = (function() { ...@@ -73,9 +73,13 @@ module.exports = (function() {
return factory return factory
} }
var importCache = {};
Sequelize.prototype.import = function(path) { Sequelize.prototype.import = function(path) {
var defineCall = require(path) if (!importCache[path]) {
return defineCall(this, DataTypes) var defineCall = require(path)
importCache[path] = defineCall(this, DataTypes)
}
return importCache[path];
} }
Sequelize.prototype.migrate = function(options) { Sequelize.prototype.migrate = function(options) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!