The team stared at the screen. A single change was needed—a new column.
Adding a new column should be simple. In many systems, it isn’t. Schema migrations block deployments. Writes pause. Read queries slow down. The wrong approach can corrupt data or break backward compatibility.
A new column in a relational database must be designed with the same care as a production API change. Decide on the column name, type, nullability, and default value. Determine if it is nullable to avoid rewriting all rows. If a default is required, set it at the application layer first.
Plan the migration in phases. Start by deploying application code that can work both with and without the column present. Only then apply the schema change. Use ALTER TABLE with online migration tools when possible—gh-ost, pt-online-schema-change, or native database capabilities like PostgreSQL’s ADD COLUMN on large tables without rewriting.