Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Lazily requiring migration file, so migration files can be squashed.

  • Loading branch information...
commit 7c22dbcdb7bfae60d67da7b9255787d9b29e9e5b 1 parent 21a9f86
@btakita btakita authored
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);
};
Please sign in to comment.
Something went wrong with that request. Please try again.