The migration was almost complete when the need for a new column stopped the deploy cold.
Adding a new column to a live database seems simple. It rarely is. The choice between blocking and non-blocking schema changes can mean the difference between seamless deployment and hours of downtime. A new column can impact indexes, queries, and replication lag. Done wrong, it can lock tables, delay writes, and drop performance under traffic.
The first step is defining the column parameters. Data type, default value, nullability, and indexing must be decided before execution. Never assume defaults; confirm they match production requirements.
For small datasets, a standard ALTER TABLE ADD COLUMN works. On large datasets, avoid full table locks. Use tools like pt-online-schema-change or gh-ost to add the new column without halting operations. Both can copy existing data into a new table with the added column while incrementally syncing changes, then swap tables almost instantly.