Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

don't allow invalid migration to boot workers

Matheus Nogueiraf860ee98ea50
diff --git a/backend/src/auto-start-migrations.ts b/backend/src/auto-start-migrations.ts
index 34f22907fe..63b9177d02 100644
--- a/backend/src/auto-start-migrations.ts
+++ b/backend/src/auto-start-migrations.ts
@@ -404,9 +404,18 @@ export const runMigrations = async ({ applicationDb, auditLogDb, clickhouseClien
// API nodes to fall behind the schema and start failing while they are not updated.
if (!getConfig().isApiRunModeEnabled) {
const bootState = await getMigrationBootState({ db: applicationDb, migrationConfig });
- if (bootState.direction === "behind" || bootState.direction === "invalid") {
+
+ if (bootState.direction === "invalid") {
+ throwInvalidMigrationHistory({
+ databaseName: "application",
+ pendingMigrationNames: bootState.pendingMigrationNames,
+ unknownAppliedMigrationNames: bootState.unknownAppliedMigrationNames
+ });
+ }
+
+ if (bootState.direction === "behind") {
logger.warn(
- `Skipping migrations: not an api run mode [direction=${bootState.direction}] [pendingCount=${bootState.pendingMigrationNames.length}]. Waiting on an api pod to apply them.`
+ `Skipping migrations: not an api run mode [direction=behind] [pendingCount=${bootState.pendingMigrationNames.length}]. Waiting on an api pod to apply them.`
);
} else {
logger.info(`Skipping migrations: not an api run mode [direction=${bootState.direction}]`);