The migration broke on line 214. The logs make it clear: the new column wasn’t there when the query ran.
Adding a new column sounds simple. In practice, it can be a source of downtime, data loss, or inconsistent states if not handled with care. Schema changes touch production databases directly. The wrong approach can lock tables, block inserts, or cause cascading failures in dependent services.
The safe way to add a new column starts with planning. Confirm the column’s type, constraints, and default values. Adding a default that requires backfilling millions of rows will lock reads and writes if done in one transaction. Instead, add the column without the default, then update rows in small batches.
Version your schema changes. In Postgres and MySQL, use migrations that can run without blocking. Test them against a copy of production data. Verify that application code can handle the column being present but not yet populated. This avoids mismatches during rolling deployments.