Skip to content

Commit 0b935d7

Browse files
committed
fix(v2): learn should write a 0 action for renaming, call endMigration for state at the end of up
Signed-off-by: Tobias Gurtzick <[email protected]>
1 parent 190a8b3 commit 0b935d7

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

lib/executors/versioned/v2.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ const execUnit = {
5555
await execUnit.down(context, driver, file);
5656
throw err;
5757
}
58-
return Promise.promisify(context.writeMigrationRecord.bind(context))(file);
58+
await Promise.promisify(context.writeMigrationRecord.bind(context))(file);
59+
return State.endMigration(context._driver, file, context.internals);
5960
// end migration, same as start migration
6061
},
6162

lib/learn.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,16 +157,17 @@ class STD {
157157
this.modS[t] = {};
158158

159159
if (this.schema[t][c].notNull === true) {
160-
switch (o.columnStrategies) {
160+
switch (o.columnStrategy) {
161161
case 'delay':
162162
this.modS[t][c] = this.schema[t][c];
163163

164164
o.passthrough = o.passthrough || {};
165165
o.passthrough.column =
166-
o.passthrough.column || `__dbmrn_${c}_${new Date().toString()}__`;
166+
o.passthrough.column ||
167+
`__dbmrn_${c}_${new Date().toISOString()}__`;
167168

168169
this.modC.push({
169-
t: 1,
170+
t: 0,
170171
a: 'renameColumn',
171172
c: [t, o.passthrough.column, c]
172173
});

0 commit comments

Comments
 (0)