Skip to content

Commit

Permalink
fix(v2): learn should write a 0 action for renaming, call endMigratio…
Browse files Browse the repository at this point in the history
…n for state at the end of up

Signed-off-by: Tobias Gurtzick <magic@wizardtales.com>
  • Loading branch information
wzrdtales committed Apr 14, 2020
1 parent 190a8b3 commit 0b935d7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lib/executors/versioned/v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ const execUnit = {
await execUnit.down(context, driver, file);
throw err;
}
return Promise.promisify(context.writeMigrationRecord.bind(context))(file);
await Promise.promisify(context.writeMigrationRecord.bind(context))(file);
return State.endMigration(context._driver, file, context.internals);
// end migration, same as start migration
},

Expand Down
7 changes: 4 additions & 3 deletions lib/learn.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,17 @@ class STD {
this.modS[t] = {};

if (this.schema[t][c].notNull === true) {
switch (o.columnStrategies) {
switch (o.columnStrategy) {
case 'delay':
this.modS[t][c] = this.schema[t][c];

o.passthrough = o.passthrough || {};
o.passthrough.column =
o.passthrough.column || `__dbmrn_${c}_${new Date().toString()}__`;
o.passthrough.column ||
`__dbmrn_${c}_${new Date().toISOString()}__`;

this.modC.push({
t: 1,
t: 0,
a: 'renameColumn',
c: [t, o.passthrough.column, c]
});
Expand Down

0 comments on commit 0b935d7

Please sign in to comment.