The query returned fast, but the table looked wrong. A missing new column broke the flow of the data, and now the deployment was stalled.
A new column sounds simple. It is not. Adding one to a production database involves schema changes, data migration, and careful rollout. The wrong approach risks downtime, conflicts, or corrupted records. The right approach integrates schema evolution into the development pipeline without slowing releases.
First, define the column at the database level. Use explicit types. Avoid NULL defaults unless required. Make index decisions early, since retrofitting indexes later on large datasets can lock tables or block writes.
Second, plan how the new column interacts with application code. Ship code that can handle both old and new schemas. Write migrations that are idempotent and can run safely multiple times. Consider backfilling data asynchronously to avoid long locks.