From 4b040b10978e68d561e8d14d0f377a407db39729 Mon Sep 17 00:00:00 2001 From: Diego Imbert Date: Fri, 3 Jul 2026 23:33:59 +0200 Subject: [PATCH] fix: fail closed on migrations-status error in fork schema merge --- .../src/lib/components/DatatableSchemaDiff.svelte | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/frontend/src/lib/components/DatatableSchemaDiff.svelte b/frontend/src/lib/components/DatatableSchemaDiff.svelte index 2b468f71c7..108353c582 100644 --- a/frontend/src/lib/components/DatatableSchemaDiff.svelte +++ b/frontend/src/lib/components/DatatableSchemaDiff.svelte @@ -355,16 +355,17 @@ // If the target data table opted in to migrations, record this merge as a // tracked migration (named after the fork) and run it, instead of applying // raw SQL that would bypass the target's migration history. - let targetUsesMigrations = false - try { - const status = await WorkspaceService.getDatatableMigrationsStatus({ + // Don't swallow a status-check failure by defaulting to raw apply: that + // would apply the DDL untracked (schema drift) — exactly what this feature + // prevents. Let the error propagate (fail closed, handled by the outer + // catch); only fall back to raw apply when the API explicitly returns + // enabled === false. + const targetUsesMigrations = ( + await WorkspaceService.getDatatableMigrationsStatus({ workspace: targetWorkspace, datatableName: dtName }) - targetUsesMigrations = status.enabled - } catch { - // Fall back to a raw apply if the status can't be read. - } + ).enabled if (targetUsesMigrations) { const forkName =