The migration froze on row 4,138. All because the schema needed a new column.
Adding a new column sounds simple. In practice, it can trigger downtime, lock tables, or cause cascading failures in production if handled carelessly. The process changes depending on database type, engine, and replication setup. It is not just about ALTER TABLE. It is about doing it without breaking the system.
In PostgreSQL, ALTER TABLE ADD COLUMN is fast when adding nullable columns with defaults of NULL. But adding a default value to existing rows writes to every row, which can lock and block queries. The safer approach is to add the column as nullable, backfill asynchronously, then set the default and add constraints once the data is ready.
In MySQL, adding a new column can require a full table rebuild, locking writes for minutes or hours. Tools like gh-ost or pt-online-schema-change create a shadow table, apply changes, and replay changes to reduce downtime. Still, understanding how indexes, data types, and storage engines behave during that rebuild is critical.