@@ -58,7 +58,7 @@ const execUnit = {
58
58
'An error occured. No alternative failure strategy defined. Rolling back!' ,
59
59
err
60
60
) ;
61
- await execUnit . down ( context , driver , file ) ;
61
+ await execUnit . down ( context , driver , file , { abort : true } ) ;
62
62
throw err ;
63
63
}
64
64
await Promise . promisify ( context . writeMigrationRecord . bind ( context ) ) ( file ) ;
@@ -104,9 +104,13 @@ const execUnit = {
104
104
// end migration, same as start migration
105
105
} ,
106
106
107
- down : async function ( context , driver , file ) {
107
+ down : async function ( context , driver , file , { abort } = { } ) {
108
+ // if we get the abort signal this means we are in a rollback routine
109
+ // which means in turn we want to avoid reloading the state
110
+ if ( abort === true ) {
111
+ await State . startMigration ( context . _pdriver , file , context . internals ) ;
112
+ }
108
113
// start migration, see up comments
109
- await State . startMigration ( context . _pdriver , file , context . internals ) ;
110
114
await TranslateState ( context . _driver , file , driver , context . internals , context . _pdriver ) ;
111
115
await State . endMigration ( context . _pdriver , file , context . internals ) ;
112
116
return Promise . promisify ( context . deleteMigrationRecord . bind ( context ) ) ( file ) ;
0 commit comments