The migration was running, and the database was locked on a hot path. You needed a new column, and you needed it without taking down production.
Adding a new column sounds simple. It rarely is at scale. Schema changes touch storage, queries, and application logic. A careless ALTER TABLE can block writes, spike CPU, and stall your API. When your dataset is measured in terabytes, the cost of mistakes is real.
The right approach starts with the database engine. In PostgreSQL, ALTER TABLE ... ADD COLUMN is fast if the column allows nulls and has no default. This is metadata-only and avoids rewriting the table. Adding a column with a default that isn’t NULL in older versions forces a full rewrite; in newer versions (PostgreSQL 11+), it still avoids locking writes, but you should run it off-peak to minimize contention.
In MySQL, the path depends on the version and storage engine. MySQL 8.0 with InnoDB can perform instant ADD COLUMN operations if constraints allow. Otherwise, use tools like pt-online-schema-change or gh-ost to avoid blocking. MariaDB has its own instant DDL features, but test them on staging — edge cases remain.