The schema had changed, but the new column wasn’t there.
A new column seems simple—add it, migrate, move on. But in production systems, even the smallest schema update can break workflows, slow queries, and cause data loss if handled poorly. Planning and executing a new column addition is a precision task.
Start with clarity on the column’s purpose. Define type, nullability, default values, and constraints before writing a migration. Think about current queries. A new column in a large table can lock rows for a long time during migration, so choose an approach that minimizes downtime. For PostgreSQL, consider ADD COLUMN with defaults that don’t rewrite the table. For MySQL, evaluate ONLINE DDL where supported.
Update application code in steps. First, deploy code that can handle both the old and new schema. Then run the migration to add the column. Finally, deploy code that depends on the new column. This phased approach keeps both schema and code compatible through the change.