Enforce invariants in the DB (NOT NULL, UNIQUE, CHECK, FOREIGN KEY) rather than application code alone. Ship zero-downtime migrations using expand-and-contract: add nullable columns, backfill in batches, create indexes CONCURRENTLY, and validate constraints with NOT VALID + VALIDATE CONSTRAINT.
Follow-up Interview Question · Why does adding a NOT NULL column with a volatile default or non-concurrent index lock writes?