The migration was breaking. You needed a new column, and you needed it without downtime.
Adding a new column in a live production database is more than an ALTER TABLE command. Schema changes risk locks, blocked queries, and cascading errors. The real task is to add structure without stopping the system. That means planning, testing, and choosing the right approach for your database engine.
In PostgreSQL, ALTER TABLE ADD COLUMN is transactional but can still lock writes. Use ADD COLUMN ... DEFAULT NULL to avoid rewriting the entire table. For MySQL, older versions will rewrite data; newer versions with ALGORITHM=INSTANT make it faster and safer. Always check your version before you run the command.
If the column needs a default value, set it in two steps: first add the nullable column, then update rows in batches. After the backfill completes, set the NOT NULL and default constraints. This avoids long locks and massive I/O spikes.