Adding a new column is common but often done wrong. Poor schema changes can lock tables, trigger downtime, or break deployments. The right approach makes the change atomic, fast, and safe.
First, define the purpose. A new column should solve a specific data requirement. Avoid adding unused fields. Decide on the column name, type, nullability, default values, and indexing strategy before you touch production.
Second, choose the migration method. On large tables, an ALTER TABLE ADD COLUMN may block reads and writes. Use an online migration tool or chunked backfill to avoid congestion. In PostgreSQL, new nullable columns with no default are instant to add. Defaults on large tables can rewrite data; avoid this by adding the column first, then updating values in batches.
Third, maintain backward compatibility. Deploy schema changes before deploying the code that depends on them. This lets old code run without errors while new code prepares to use the new column. The reverse is critical for removing columns: update your code first, then drop the column later.