The migration ran fast until it hit the table. The schema needed a new column, and everything stopped.
Adding a new column is simple in theory. In practice, it can lock rows, stall writes, or break production services if mishandled. Precision matters. Speed matters. Knowing when and how to add a column without downtime is the mark of a stable system.
In SQL, ALTER TABLE ADD COLUMN is the standard. It modifies the schema in place. The danger: on large datasets, the operation can hold a lock for minutes or hours. For PostgreSQL, adding a column with a default value rewrites the whole table. For MySQL, the impact depends on the storage engine and the version. The safest path is to add the column empty, then backfill in controlled batches.
Consider nullability. Adding a NOT NULL column with no default will fail if existing rows have no value for it. Adding a column with a default can be slow but consistent. Use migration tools—Flyway, Liquibase, or custom scripts—to run changes inside transactions when possible. Always stage changes in development and load test with realistic data volumes.