The logs showed the reason in one line: missing column.
Adding a new column sounds simple. It can be—if it’s planned, executed, and deployed without breaking production. In modern systems, schema changes happen while traffic flows. The database has no pause button. A careless ALTER TABLE can lock rows, block writes, and bring down the service.
The safest path starts with understanding how your database handles schema evolution. MySQL, PostgreSQL, and cloud-managed warehouses each have different locking and storage behaviors when adding a new column. Some operations are instant for small tables. Others rewrite the full dataset.
When adding a new column, define the strategy before touching the schema:
- Use explicit data types. Avoid defaults that might cause implicit casts.
- Decide if the column should allow NULLs, and understand the impact on storage and indexes.
- For large tables, consider backfilling data in batches with asynchronous jobs rather than during the schema change.
- Keep the first migration lightweight. If the column will be indexed, add the index in a separate deployment.
Version your schema changes. Use a migration tool—Flyway, Liquibase, Prisma, or built-in frameworks—to track history and enable rollback. Never apply production migrations manually from a terminal.