A new column in a database is simple in theory—add the field, set constraints, migrate data, deploy. In practice, speed and precision matter. Schema changes can block deploy pipelines, lock tables, or break downstream systems. Knowing how to add a new column without downtime is a core skill.
Plan the migration. Decide if the column is nullable or needs a default value. On large tables, adding a non-null column with a default can cause a full table rewrite. In PostgreSQL, use ADD COLUMN with NULL first, then backfill in batches. In MySQL, consider ALGORITHM=INPLACE if the storage engine supports it.
Handle data consistency. Backfill old rows incrementally to avoid load spikes. Verify after each batch. If the new column replaces derived data, double-write during the transition and validate parity before cutting reads over.