The migration was done, but one table felt wrong. It needed a new column.
Adding a new column should be simple, but the real challenge is doing it safely, fast, and without downtime. Schema changes look harmless until they lock tables during peak traffic or break old code paths still in production. Production databases demand precision, and adding a column is one of those operations where the smallest mistake can ripple through logs, alerts, and angry customers.
The first question is scope. Decide if the new column is nullable, has a default value, or needs a constraint. A nullable column is the fastest to add. A column with a default forces the database to rewrite every row, which on large tables can stall writes. If your default is needed, write a migration that adds the column empty, then backfill in small batches. After backfill, add the constraint.
For relational databases like PostgreSQL or MySQL, plan each step to avoid locking patterns. Test with realistic data volumes. If you use replication, watch replication lag after the migration. Lag spikes can reveal heavy DDL operations.