Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
skip migration in non-api modes
Matheus Nogueirabd17bd46d6bc
diff --git a/backend/src/auto-start-migrations.ts b/backend/src/auto-start-migrations.tsindex 3f5af076b7..34f22907fe 100644--- a/backend/src/auto-start-migrations.ts+++ b/backend/src/auto-start-migrations.ts@@ -400,6 +400,20 @@ export const runMigrations = async ({ applicationDb, auditLogDb, clickhouseClienconst generateSanitizedSchema = process.env.GENERATE_SANITIZED_SCHEMA === "true";const failOnSanitizedSchemaError = process.env.FAIL_ON_SANITIZED_SCHEMA_ERROR === "true";+ // Only API should run migrations. Workers don't run them to prevent+ // 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") {+ logger.warn(+ `Skipping migrations: not an api run mode [direction=${bootState.direction}] [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}]`);+ }+ return;+ }+try {// akhilmhdh(Feb 10 2025): 2 years from now remove thisif (isProduction) {