Adding a new column in a production database sounds routine, but it is often the knife’s edge between stability and failure. The wrong type, the wrong default, the wrong migration strategy—these are not inconveniences. They are outages.
The first step is always clarity. Define the column’s exact purpose. Name it so its meaning will be clear five years from now. Decide the data type based on its true use, not on shortcuts. Each decision here is a safeguard against silent corruption later.
In PostgreSQL, ALTER TABLE ADD COLUMN is fast when adding a nullable column without a default. Adding NOT NULL with a default to a large table can lock writes and stall your application. MySQL behaves differently but with its own traps. Understand your engine’s exact behavior before you run the change.
Plan the deployment in steps. Add the column. Allow nulls. Backfill in small, safe batches. Once every row is correct, enforce constraints. This sequence reduces lock contention and avoids long transactions.