Adding a new column sounds trivial. In production, it’s not. Schema changes can lock tables, trigger downtime, or break queries. The stakes rise with scale, concurrency, and data volume. A careless migration can ripple through every service that touches the database.
A safe new column starts with a migration plan. First, define the column with defaults that won’t block writes. If using PostgreSQL, avoid operations that rewrite the whole table; use ALTER TABLE … ADD COLUMN with DEFAULT only when the value is constant. For MySQL, ensure your engine and version support instant DDL for the data type you need.
Second, add the column but keep it unused in application logic until deployment is finished. Backfill in small batches to avoid spikes in I/O and lock time. This step can run asynchronously, even in background jobs. Monitor metrics—latency, error rate, replication lag—before and after each phase.