The migration stalled when the database engine hit the missing fields. You needed a new column, and you needed it fast.
Adding a new column to a production table can be trivial or dangerous, depending on the scale and state of your data. Planned well, the schema change fits into a release without downtime. Planned poorly, it locks tables, spikes CPU, and stops transactions cold.
First, define the purpose of the new column. Keep types precise—INT is not BIGINT and VARCHAR without a length is a trap. Specify defaults only when they make sense. Avoid nullability when data integrity matters.
Next, decide on your migration strategy. For small tables, a direct ALTER TABLE ADD COLUMN works. For large datasets, break the change into phases:
- Add the column as nullable with no default.
- Backfill data in small batches to reduce lock times.
- Add constraints or defaults only after the data is in place.
Test in an environment with production data volume. Watch how long the DDL takes. Track query plans before and after. New columns can affect indexing strategies and execution paths.