Adding a new column should be simple. In reality, it can trigger migrations that block writes, impact performance, or break downstream systems. The goal is to make the change without downtime, without data loss, and without surprises.
Start with a migration plan. Define the new column in your DDL, but consider defaults, nullability, and type. If the table is large, a blocking ALTER TABLE can lock reads and writes. Use an online schema change tool or a migration strategy that stages in phases:
- Add the new column with a safe operation.
- Backfill data in small batches.
- Update application code to read and write the new column.
- Remove feature flags after confirming stability.
Think about indexing. Adding an index with the new column can speed queries but can also be costly to build in production. Create it after the column exists and data is populated, ideally during low-traffic windows.