-
-
Notifications
You must be signed in to change notification settings - Fork 359
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(files): some more changes to file, walker as well as the
start of the port of the version 1 schema. Refers to #215 Signed-off-by: Tobias Gurtzick <[email protected]>
- Loading branch information
Showing
3 changed files
with
105 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
var log = require('db-migrate-shared').log; | ||
var Promise = require('bluebird'); | ||
|
||
const execUnit = { | ||
up: function (context, driver, execUnit) { | ||
return context.driver | ||
.startMigration() | ||
.then(() => { | ||
var setup = execUnit.setup; | ||
|
||
if (typeof setup === 'function') { | ||
setup(context.internals.execUnitOptions, context.seedLink); | ||
} | ||
|
||
return execUnit.up(); | ||
}) | ||
.then(() => { | ||
return Promise.promisify(context.writeexecUnitRecord.bind(context))( | ||
execUnit | ||
); | ||
}) | ||
.then(context.driver.endMigration.bind(context.driver)); | ||
}, | ||
|
||
down: function (context, driver, execUnit) { | ||
return driver | ||
.startMigration() | ||
.then(() => { | ||
var setup = execUnit.setup; | ||
|
||
if (typeof setup === 'function') { | ||
setup(context.internals.execUnitOptions, context.seedLink); | ||
} | ||
|
||
return execUnit.down(); | ||
}) | ||
.then(() => { | ||
return Promise.promisify(context.deleteexecUnitRecord.bind(context))( | ||
execUnit | ||
); | ||
}) | ||
.then(context.driver.endMigration.bind(context.driver)); | ||
} | ||
}; | ||
|
||
module.exports = execUnit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters