Skip to content

Commit eaeeb60

Browse files
committed
Revert "Remove forceActions flag"
This reverts commit 360599a.
1 parent 28cea06 commit eaeeb60

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

src/commands/current.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ import { _migrate } from "./migrate";
99

1010
interface CurrentArgv extends CommonArgv {
1111
shadow?: boolean;
12+
forceActions?: boolean;
1213
}
1314

1415
export 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 });

src/currentRunner.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff 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,

0 commit comments

Comments
 (0)