The migration stopped cold. A new column was needed, but the production database was under full load, and every second counted.
Adding a new column is routine, but doing it on a live system without downtime takes skill. Schema changes can lock tables, block writes, and trigger cascading performance issues if executed carelessly. Choosing the right approach depends on database type, version, and storage engine.
In PostgreSQL, adding a nullable column with a default of NULL is nearly instant since it only updates metadata. Adding a NOT NULL with a default value, however, forces a full table rewrite unless you first add the column as nullable, backfill in batches, and then set the constraint. MySQL behaves differently — InnoDB supports some instant column additions, but length changes or certain data types still require table rebuilds. For large datasets, online schema change tools like pt-online-schema-change or gh-ost can run the operation without locking the table.