The migration froze halfway. A table was locked, and the new column that should have been trivial became the blocker.
Adding a new column in production is rarely just running ALTER TABLE. Schema changes at scale impact query performance, replication lag, and lock durations. The process needs planning, rollbacks, and sometimes online schema change tools.
The first step is to analyze table size and traffic patterns. On large datasets, a blocking lock can halt downstream services. Use metadata queries to check row counts, indexes, and constraints before starting. If the new column requires a default value, beware: some databases rewrite the entire table, creating long operation times.
In MySQL and MariaDB, ALTER TABLE ADD COLUMN can be instant if it only modifies metadata, but that depends on storage engine and column properties. PostgreSQL can add a nullable column fast, but adding a column with a default in older versions rewrites the table. Online schema change tools like gh-ost or pt-online-schema-change split the operation into small chunks, avoiding downtime.