Adding a new column sounds simple, but it can break production, silently corrupt data, or stall deploys if done wrong. Schema changes are not just database actions. They are part of the system’s contract. Every read, write, and query depends on them.
Before adding a column, confirm the requirement in code. Identify exactly which services will use it and what default values they expect. Skipping this step creates hidden nulls and undefined behavior.
Plan the migration in phases. First, add the new column as nullable with no default to avoid table locks during creation. Deploy this to production without yet writing to it. Then, update your application code to start populating the column for new records. Once you verify that traffic is writing correctly, backfill the column for existing rows in small batches to avoid heavy load and long locks.
For large datasets, use an online migration tool or chunk updates by primary key ranges. Index the column only after it is fully populated if queries will rely on it. Adding an index too early on an empty column is wasted cost.