The migration failed. All because the database needed a new column.
Adding a new column sounds simple, but under load it can be the most dangerous schema change in your system. On production databases with millions of rows, an ALTER TABLE can lock writes, block reads, or spike CPU until you hit an outage. The problem is not just the new field—it’s how the database engine rewrites storage, updates indexes, and applies constraints in real time.
PostgreSQL, MySQL, and other relational systems each have their own rules for adding columns. In PostgreSQL, adding a nullable column without a default is fast—it only updates metadata. Add a column with a default value, though, and the database rewrites every row. That rewrite scales with table size, making the operation unsafe without planning.
On MySQL with InnoDB, ALTER TABLE copies the table by default. That means downtime unless you use ALGORITHM=INPLACE where possible, or tools like pt-online-schema-change. Even then, the migration consumes I/O and can cause replication lag.