From f77b81267933d2f868b4af188be73b2bbb70a879 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 8 Jan 2024 12:15:12 +0100 Subject: [PATCH] Handle no migrations --- packages/server/src/api/controllers/static/index.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/server/src/api/controllers/static/index.ts b/packages/server/src/api/controllers/static/index.ts index 0166f92478..5f383e837d 100644 --- a/packages/server/src/api/controllers/static/index.ts +++ b/packages/server/src/api/controllers/static/index.ts @@ -135,9 +135,14 @@ const requiresMigration = async (ctx: Ctx) => { ctx.throw("AppId could not be found") } - const latestAppliedMigration = await getAppMigrationVersion(appId) + const latestMigration = getLatestMigrationId() + if (!latestMigration) { + return false + } - const requiresMigrations = latestAppliedMigration !== getLatestMigrationId() + const latestMigrationApplied = await getAppMigrationVersion(appId) + + const requiresMigrations = latestMigrationApplied !== latestMigration return requiresMigrations }