From f224f41126d9d7d8a081f1a15c07c05bfe599dda Mon Sep 17 00:00:00 2001 From: Amp Date: Tue, 21 Jul 2026 04:44:25 +0000 Subject: [PATCH] Fail closed on destructive schema changes Co-authored-by: Arjun Komath --- deployment/README.md | 2 +- deployment/compose.postgres.yml | 2 +- deployment/compose.production.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/deployment/README.md b/deployment/README.md index 1d605523..1f843e94 100644 --- a/deployment/README.md +++ b/deployment/README.md @@ -88,7 +88,7 @@ start, so scaling `WEB_REPLICAS` does not run migrations from every replica. ## Database Migrations -Schema is synced automatically by the one-shot `migrate` service via `drizzle-kit push --force`. This keeps deployment non-interactive, including schema changes Drizzle classifies as data-loss operations such as dropping columns. If schema sync fails, `web` startup is blocked; inspect the failure with `docker compose -f compose.production.yml logs migrate`. +Schema is synced automatically by the one-shot `migrate` service via `drizzle-kit push`. Non-destructive changes are applied automatically. Changes Drizzle classifies as data-loss operations fail closed and require manual intervention. If schema sync fails, `web` startup is blocked; inspect the failure with `docker compose -f compose.production.yml logs migrate`. **Future plan:** Once the schema stabilizes, switch to `drizzle-kit generate` + `drizzle-orm migrate()` with pre-generated SQL migration files. This will eliminate the esbuild/drizzle-kit dependency from the production image. diff --git a/deployment/compose.postgres.yml b/deployment/compose.postgres.yml index 1f0f3619..1c1ae7b9 100644 --- a/deployment/compose.postgres.yml +++ b/deployment/compose.postgres.yml @@ -93,7 +93,7 @@ services: depends_on: postgres: condition: service_healthy - command: ["npx", "drizzle-kit", "push", "--force"] + command: ["npx", "drizzle-kit", "push"] restart: on-failure web: diff --git a/deployment/compose.production.yml b/deployment/compose.production.yml index d3c1185c..bea012d3 100644 --- a/deployment/compose.production.yml +++ b/deployment/compose.production.yml @@ -72,7 +72,7 @@ services: - CONTROL_PLANE_UPDATER_URL=http://control-plane-updater:8080 - CONTROL_PLANE_UPDATER_TOKEN=${CONTROL_PLANE_UPDATER_TOKEN} - ALLOW_SIGNUP=${ALLOW_SIGNUP:-false} - command: ["npx", "drizzle-kit", "push", "--force"] + command: ["npx", "drizzle-kit", "push"] restart: on-failure web: