Adding a new column is simple in theory—one line in an ALTER TABLE statement. In production, it is never that simple. The wrong migration locks tables, spikes load, and slows down the application. The right migration fits into the system like it was always there.
First, define why the new column exists. Avoid storing data you do not need. A new column should solve a real problem—improving queries, enabling features, or supporting analytics.
Next, choose the column type with care. Changing column types later is high‑risk. Decide on NULL vs NOT NULL early and know the default value. If possible, add the column as nullable, backfill data in small batches, then make it non‑null.
For large tables, use online schema changes. PostgreSQL offers ADD COLUMN instantly for most cases, but MySQL’s older versions may lock the table. Tools like gh-ost or pt-online-schema-change can handle migrations without downtime.