The database table sat still, but the code demanded change. A new column had to be added, and the migration had to run without breaking a single query.
Creating a new column is simple in theory. In practice, it requires exact steps to avoid downtime, preserve data integrity, and keep deployments reversible.
First, define the schema change. In SQL, this often means using ALTER TABLE with an ADD COLUMN statement. Name the column with intent. Match its type to the data it will store. Use constraints only when you are sure the values will always comply; avoid locking writes longer than necessary.
Second, deploy in phases. Add the new column as nullable to reduce migration time. Backfill data in batches, using short transactions to prevent locking large portions of the table. Once the column is fully populated, apply indexing if needed. Then make it non-nullable if the logic demands it.