Adding a new column is one of the most common schema updates in production. Done wrong, it stalls deploys, locks tables, and blocks writes. Done right, it ships without downtime, keeps queries fast, and preserves data integrity.
First, define why the new column exists. Avoid orphaned fields. Decide on datatype, constraints, default values, and whether it must be nullable. In transactional systems, the wrong default can trigger full table rewrites.
Second, assess the migration path. On large tables, adding a column with a non-null default requires a table rewrite. That can take minutes or hours. Use NULL defaults, then backfill in batches. Write scripts that chunk updates and commit often.
Third, deploy in stages. Tools like pt-online-schema-change or native ALTER TABLE in concurrent mode (PostgreSQL ADD COLUMN ... DEFAULT with NOT NULL in later step) help avoid locks. Always isolate schema changes from application logic until the new column exists everywhere.