fix: fail closed on migrations-status error in fork schema merge

This commit is contained in:
Diego Imbert
2026-07-03 23:33:59 +02:00
parent 50a75d042f
commit 4b040b1097
@@ -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 =