The build had passed, but something was wrong in production. A missing field. A broken query. In the logs, the culprit was clear: the new column wasn’t there.
Adding a new column to a database table should be simple. The challenge is doing it without downtime, data loss, or breaking dependent services. Schema changes ripple through code, migrations, and deployments. If the process is sloppy, you ship bugs. If it’s slow, you block features.
First, define the column with exact types and constraints. Avoid vague defaults. Use a migration tool that supports transactional DDL where possible. On large tables, test the migration on a clone to measure runtime. For high-traffic production systems, consider creating the column as nullable, backfilling data in controlled batches, and adding constraints only after the backfill completes.