Adding a new column to a database table is simple in theory. In production, it is a minefield. You must plan for downtime, locking, replication lag, and code deployment order. The change must be reversible, performant, and safe under load.
In SQL, ALTER TABLE is the starting point. With MySQL and PostgreSQL, adding a nullable column without a default is often instant on modern versions. Adding a column with a default on billions of rows can lock your table. You avoid this by adding it without a default, backfilling in batches, then setting the default in a later migration.
Nullability matters. A new column that is NOT NULL from the start can break existing writes. Add it as nullable, backfill, verify, then enforce constraints. For large data, run backfill jobs in small committed chunks to avoid bloating transaction logs and slowing replicas. Track percent completion and monitor queries.
Coordinate code changes around the deployment cycle. Deploy read logic that can handle both the absence and presence of the new column. Only when the column is in place and populated should you deploy the write logic. This avoids race conditions during the rollout.