-
-
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.
feat(migration): add support for first basic options on new schema
Signed-off-by: Tobias Gurtzick <[email protected]>
- Loading branch information
Showing
7 changed files
with
125 additions
and
24 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
const Promise = require('bluebird'); | ||
const State = require('../../state'); | ||
|
||
const f = { | ||
createTable: async (driver, [t], internals) => { | ||
// console.log(t, internals.modSchema, internals.modSchema.c[t]); | ||
return driver.createTable(t, internals.modSchema.c[t]); | ||
} | ||
}; | ||
|
||
async function processEntry ( | ||
context, | ||
file, | ||
driver, | ||
internals, | ||
{ t: type, a: action, c: args } | ||
) { | ||
// console.log('hello', type, action, args); | ||
switch (type) { | ||
case 0: | ||
await driver[action].apply(driver, args); | ||
break; | ||
case 1: | ||
await f[action](driver, args, internals); | ||
break; | ||
|
||
default: | ||
throw new Error(`Invalid state record, of type ${type}`); | ||
} | ||
|
||
internals.modSchema.s.shift(); | ||
await State.update(context, file, internals.modSchema, internals); | ||
} | ||
module.exports = async (context, file, driver, internals) => { | ||
const mod = internals.modSchema; | ||
|
||
await Promise.resolve(mod.s).each(args => | ||
processEntry(context, file, driver, internals, args) | ||
); | ||
|
||
await State.deleteState(context, file, internals); | ||
}; |
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