A new requirement hit, and now you need a new column. Not next week. Now.
Adding a new column seems simple—one more field, a quick migration, done. In reality, it can ripple across application code, queries, indexes, and integrations. A single ALTER TABLE might lock production for minutes or hours if done carelessly. In high-traffic systems, even seconds matter.
The safest approach is to treat every schema change as production code. Write migrations that are forward-compatible. Add the new column with a default of NULL to avoid full table rewrites. Backfill data in small batches to prevent spikes in load. Deploy application changes in phases—first allow code to write to the new column without reading from it, then backfill, then switch reads. This prevents downtime and data integrity issues.
When naming the new column, stick to lowercase, underscores, and clear meaning. Avoid reserved words. Document whether it’s indexed, nullable, and what it represents. If it needs an index for reads, add it after backfill to avoid long locks.