The migration failed at 02:14. The logs showed one reason: missing new column in production.
Adding a new column sounds trivial. It’s not. Done wrong, it locks tables, blocks writes, or breaks queries in live traffic. In high-throughput systems, the wrong ALTER TABLE can cascade into downtime.
A new column in SQL is a schema change that adds an additional field to an existing table. This update must preserve data integrity, maintain performance, and minimize blocking. For MySQL and Postgres, each engine has its own execution plan for schema changes. Some operations run in-place. Others need a table rewrite.
Before adding the new column, inspect the table size, index structure, and constraints. On large datasets, a blocking DDL will hold locks for the duration of the change. Consider online schema change tools like pt-online-schema-change for MySQL or pg_online_schema_change for Postgres to avoid downtime.
Define the new column with default values carefully. Setting a default on a huge table triggers a full table update unless the database supports metadata-only changes for that action. Always test in staging with production-like data volume.