Migrations Best Practices
Rules for versioned schema change that survives continuous deploy, large tables, and 3 AM rollbacks.
Search across all documentation pages
Rules for versioned schema change that survives continuous deploy, large tables, and 3 AM rollbacks.
app_migrator, objects owned by app_owner. Runtime role has no DDL.lock_timeout in migration SQL. Fail fast instead of blocking app traffic.statement_timeout per statement type. High for CONCURRENTLY, low for trial DDL.CREATE INDEX CONCURRENTLY in separate file with runner txn disabled.indisvalid after run.psql -f assert_schema.sql with ON_ERROR_STOP.db/migration/**.Same PR + pipeline urgency path; never psql hotfix on primary without backfill into git migration immediately after.
Only via baseline ADR on greenfield clones - never rewrite history prod already applied.
Stack versions: This page was written for PostgreSQL 18.4 (stable 18, maintenance 17), pgvector 0.8+, PgBouncer 1.x, Patroni 3.x, and PostGIS 3.5+.
Reviewed by Chris St. John·Last updated Jul 18, 2026