fix(db): disable statement_timeout for migrations#4714
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryMedium Risk Overview The new migration entrypoint uses a single Postgres connection ( Reviewed by Cursor Bugbot for commit 1ca4dba. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThis PR adds a single
Confidence Score: 5/5Safe to merge — the change is minimal, well-reasoned, and the disabled timeout cannot escape the migration process. The single added line correctly targets the session on the only connection in the pool, migration queries inherit the setting, and the connection is always closed in the existing No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant Script as migrate.ts
participant Pool as postgres pool (max: 1)
participant PG as PostgreSQL
Script->>Pool: "SET statement_timeout = 0"
Pool->>PG: "SET statement_timeout = 0 (session-level)"
PG-->>Pool: "OK"
Pool-->>Script: "OK"
Script->>Pool: "migrate(drizzle(client), ...)"
Pool->>PG: "DDL statements (ALTER TABLE, CREATE INDEX ...)"
PG-->>Pool: "OK (no timeout)"
Pool-->>Script: "migrations complete"
Script->>Pool: "client.end()"
Pool->>PG: "connection closed (timeout setting discarded)"
Reviews (1): Last reviewed commit: "fix(db): disable statement_timeout for m..." | Re-trigger Greptile |
Summary
statement_timeout = 0before running migrations inpackages/db/scripts/migrate.tsso long-running DDL isn't killed by the session's statement timeout. Single connection (max: 1), so the SET applies to the whole migration run; no infra/ECS changes needed.Database MigrationsCI workflow through the now-guardedmigrate.ts(bun run ./scripts/migrate.ts) instead of callingdrizzle-kit migratedirectly. That path applies migrations to the real dev/staging/prod DBs and previously had no timeout guard. Single source of truth, and it also picks up the richer migration error output.Type of Change
Testing
Tested manually — lint and API boundary validation pass
Checklist