Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Lazily require migration #78

Merged
merged 1 commit into from

2 participants

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 4 deletions.
  1. +8 −4 lib/migration.js
View
12 lib/migration.js
@@ -75,13 +75,17 @@ Migration = function() {
this.name = Migration.parseName(this.path);
this.date = parseDate(this.name);
this.title = parseTitle(this.name);
-
- var migrationFile = require(this.path);
- this._up = migrationFile.up;
- this._down = migrationFile.down;
}
};
+Migration.prototype._up = function() {
+ return require(this.path).up.apply(this, arguments);
+};
+
+Migration.prototype._down = function() {
+ return require(this.path).down.apply(this, arguments);
+};
+
Migration.prototype.write = function(callback) {
fs.writeFile(this.path, migrationTemplate, callback);
};
Something went wrong with that request. Please try again.