Adding a new column to a production database is simple in theory but high risk in practice. Done wrong, it blocks queries, locks writes, and breaks deployments. Done right, it delivers fast iteration without downtime or data loss.
Start by clarifying the change: name, type, default value, nullability. If you run a large dataset, avoid expensive defaults in the migration itself. Add the column as nullable first. Backfill in small batches. Monitor load and query performance throughout.
For PostgreSQL, use ALTER TABLE ... ADD COLUMN to introduce the field. Keep the new column unused in application code until the migration is complete. In MySQL, watch for table rebuilds—on older versions, a new column can trigger a full copy. Modern versions with instant add column make this safer.
Deploy in phases. Phase one: deploy the schema change with the column unused. Phase two: backfill. Phase three: deploy application code that reads and writes to the new column. This prevents race conditions and production errors.