The commit went through, but the database schema was already out of date. You needed a new column, and you needed it without breaking production.
Adding a new column sounds simple. In production systems, it rarely is. Schema changes can lock tables, slow queries, or trigger downtime. A careful approach avoids lost data and broken services.
First, define the new column with the correct data type and constraints. Decide if it should allow NULL values. This choice can determine whether the migration completes in seconds or minutes. For large datasets, add the column without constraints, backfill in batches, then enforce rules once the data is ready.
Use online schema change tools when possible. Options like pt-online-schema-change or built-in features in PostgreSQL, MySQL, and modern cloud databases let you add columns with minimal locking. Always test migrations in a staging environment that mirrors production load.