The build had failed again. The logs were clean except for one line: database migration error, missing column. You know what that means—you need a new column.
Adding a new column sounds simple. It isn’t. The wrong migration can stall deploys, block queries, and trigger outages. The right approach is deliberate.
First, define the column in your migration tool of choice. Keep it explicit: column name, data type, default value if needed. In SQL, use ALTER TABLE or its framework-specific equivalent. Always check constraints. If your table has millions of rows, adding a column with a non-null default will lock writes until the migration completes. That’s downtime.
Use additive changes. Create the new column as nullable, then backfill data in controlled batches. After that, enforce NOT NULL or add indexes. This two-phase pattern keeps production online.