The product team needed a fix. The database needed a new column.
Adding a new column sounds simple. It can be. But the wrong approach burns hours, locks tables, or drops performance at scale. Done right, it deploys cleanly, without breaking queries or slowing production traffic.
The first step: define the column and its type with precision. Make sure the schema change matches both the current data and the code paths that will use it. Use ALTER TABLE ... ADD COLUMN in SQL, but verify constraints and defaults before running it on production. Avoid setting a non-null default on massive tables; it can block for minutes or hours.
For high-traffic systems, roll out the new column in a migration that runs fast. Add the column as nullable. Backfill data in controlled batches. Update the application code to read from the column only after the backfill completes. Then enforce constraints in a second migration. This avoids downtime and reduces lock contention.