Browsing: database migrations

How to change a busy PostgreSQL schema without an outage: why ALTER TABLE locks queue up, lock_timeout and retries, which operations are safe, concurrent indexes, NOT VALID foreign keys and NOT NULL constraints, renaming a column with the expand-contract pattern, batched backfills in a procedure, deploy ordering, and settings for Rails and Django migrations.