Adding a new column to a production database is simple in theory but risky in practice. Downtime, locking, and performance regressions can turn a small change into a full incident. The key is speed and safety. Handle schema migrations with the same rigor as code changes.
When you add a new column, define its purpose and data type upfront. Avoid guessing at nullability or defaults later — these choices affect indexes, query plans, and application logic. If the column will be large or indexed, test insert and update performance before deployment.
Zero-downtime migrations rely on staged rollouts. Create the new column first, without constraints that lock the table. Backfill data in small batches to reduce load. Add indexes and constraints in separate steps, monitoring metrics after each change. Use feature flags in the application to gate reads and writes until the schema is fully ready.