The feature needed one more field. You had to add a new column.
Adding a new column in production is never just one command. It’s about preserving data integrity, managing migrations, and ensuring zero downtime. When your table is live and your queries handle thousands of requests per second, you need precision.
Start with the migration. Name it clearly. Use a reversible change when possible. Define constraints, defaults, and nullability in the migration script. Avoid adding a new column as nullable if you plan to require it later—write a backfill step and lock it down.
For relational databases like PostgreSQL or MySQL, adding a new column is often instant if defaults are static. But when defaults require computation, use batch updates to prevent table locks. Monitor queries during rollout to catch unexpected performance hits.