From 90db9efb7045d0dfbf7db6e294442d64e150e816 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 29 Dec 2023 12:43:39 +0100 Subject: [PATCH] Allow skipping migrations --- packages/backend-core/src/environment.ts | 1 + packages/server/src/middleware/appMigrations.ts | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/packages/backend-core/src/environment.ts b/packages/backend-core/src/environment.ts index 138dbbd9e0..66c91b19fb 100644 --- a/packages/backend-core/src/environment.ts +++ b/packages/backend-core/src/environment.ts @@ -183,6 +183,7 @@ const environment = { environment[key] = value }, ROLLING_LOG_MAX_SIZE: process.env.ROLLING_LOG_MAX_SIZE || "10M", + SKIP_APP_MIGRATIONS: process.env.SKIP_APP_MIGRATIONS || false, } // clean up any environment variable edge cases diff --git a/packages/server/src/middleware/appMigrations.ts b/packages/server/src/middleware/appMigrations.ts index 36e021c7ed..1fb13094c6 100644 --- a/packages/server/src/middleware/appMigrations.ts +++ b/packages/server/src/middleware/appMigrations.ts @@ -1,9 +1,14 @@ import { UserCtx } from "@budibase/types" import { checkMissingMigrations } from "../appMigrations" +import { env } from "@budibase/backend-core" export default async (ctx: UserCtx, next: any) => { const { appId } = ctx + if (env.SKIP_APP_MIGRATIONS) { + return next() + } + if (!appId) { return next() }