fix(broker): add BROKER_SKIP_MIGRATE=1 escape hatch for manual-migrated DBs
Some checks failed
CI / Lint (push) Has been cancelled
CI / Typecheck (push) Has been cancelled
CI / Broker tests (Postgres) (push) Has been cancelled
CI / Docker build (linux/amd64) (push) Has been cancelled

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Alejandro Gutiérrez
2026-04-16 12:59:28 +01:00
parent 9f3a82dd63
commit 2edbfce7d3

View File

@@ -4448,10 +4448,16 @@ async function recoverScheduledMessages(): Promise<void> {
}
async function main(): Promise<void> {
// Run pending migrations before the first connection is accepted.
// Exits non-zero on failure so Coolify sees a broken container.
// Auto-migrate: skip when BROKER_SKIP_MIGRATE=1 (e.g. when the prod
// DB was already manually migrated and the drizzle tracking table is
// out of sync). Once drizzle's __drizzle_migrations is caught up,
// remove the flag.
if (process.env.BROKER_SKIP_MIGRATE !== "1") {
const { runMigrationsOnStartup } = await import("./migrate");
await runMigrationsOnStartup();
} else {
console.log("[migrate] skipped (BROKER_SKIP_MIGRATE=1)");
}
const wss = new WebSocketServer({
noServer: true,