Adding a new column sounds simple. In production, it can break queries, APIs, and dashboards if done without care. The key is planning for compatibility, zero downtime, and clean code. This is not just database work — it’s a workflow change.
First, decide if the new column is nullable. Making it NOT NULL requires either backfilling data in a single transaction or adding the column as nullable, then populating it in batches before enforcing constraints. This avoids table locks that can stall traffic.
Then, update the schema in a migration script. Keep it version-controlled. Use explicit types. Avoid defaults that mask missing data unless the default is part of the domain logic.
Next, ensure the application layer knows the new column exists. Update ORM mappings, DTOs, and API contracts. Add the new column to SELECT queries and INSERT statements where required, but leave legacy code untouched until the rollout is coordinated.