File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,13 +9,14 @@ import { _migrate } from "./migrate";
99
1010interface CurrentArgv extends CommonArgv {
1111 shadow ?: boolean ;
12+ forceActions ?: boolean ;
1213}
1314
1415export async function current (
1516 settings : Settings ,
1617 options : Partial < CurrentArgv > = { } ,
1718) : Promise < void > {
18- const { shadow = false } = options ;
19+ const { shadow = false , forceActions = false } = options ;
1920 const parsedSettings = await parseSettings ( settings , shadow ) ;
2021 await _migrate ( parsedSettings , shadow ) ;
2122
@@ -31,6 +32,7 @@ export async function current(
3132 const run = makeCurrentMigrationRunner ( parsedSettings , {
3233 once : true ,
3334 shadow,
35+ forceActions,
3436 } ) ;
3537 return run ( ) ;
3638}
@@ -49,6 +51,12 @@ export const currentCommand: CommandModule<
4951 default : false ,
5052 description : "Apply migrations to the shadow DB (for development)." ,
5153 } ,
54+ forceActions : {
55+ type : "boolean" ,
56+ default : false ,
57+ description :
58+ "Run beforeAllMigrations and afterAllMigrations actions even if no migration was necessary." ,
59+ } ,
5260 } ,
5361 handler : async ( argv ) => {
5462 const settings = await getSettings ( { configFile : argv . config } ) ;
Original file line number Diff line number Diff line change @@ -13,9 +13,10 @@ export function makeCurrentMigrationRunner(
1313 options : {
1414 once ?: boolean ;
1515 shadow ?: boolean ;
16+ forceActions ?: boolean ;
1617 } = { } ,
1718) : ( ) => Promise < void > {
18- const { shadow = false } = options ;
19+ const { shadow = false , forceActions = false } = options ;
1920 async function run ( ) : Promise < void > {
2021 const currentLocation = await getCurrentMigrationLocation ( parsedSettings ) ;
2122 const body = await readCurrentMigration ( parsedSettings , currentLocation ) ;
@@ -75,7 +76,7 @@ export function makeCurrentMigrationRunner(
7576 currentBodyMinified === previousBodyMinified ;
7677
7778 // 4: if different
78- if ( ! migrationsAreEquivalent ) {
79+ if ( forceActions || ! migrationsAreEquivalent ) {
7980 await executeActions (
8081 parsedSettings ,
8182 shadow ,
You can’t perform that action at this time.
0 commit comments