The code was clean until the schema changed. Then you needed a new column.
Adding a new column sounds simple. In practice, it can break builds, slow deploys, or block releases if done without planning. The database is often the hardest part of shipping fast. Schema changes touch production data. They can lock tables, trigger migrations, and ripple through the codebase.
When you create a new column in SQL, you face two primary decisions:
- Definition – choose column name, type, nullability, default values.
- Migration strategy – decide how to add it without downtime.
On large tables, ALTER TABLE ADD COLUMN in one transaction can cause long locks. Use online schema change tools or partitioned migrations. Fill existing rows in batches. Backfill asynchronously. Always measure the impact on read and write performance.