Adding a new column sounds simple, but it can tear through dependencies, migrations, and code paths if done without control. The right process reduces downtime, prevents data loss, and keeps deploys safe.
Start with a clear migration plan. Choose between schema-first and application-first changes. Schema-first means altering the table structure before writing code that uses it. Application-first means writing flexible code that tolerates the missing column, then deploying the schema change.
For PostgreSQL, use ALTER TABLE ... ADD COLUMN with a default only when necessary. Adding a column without a default is fast. Adding one with a default forces a rewrite of the table, which can lock it for a long time on large datasets. In MySQL, ALTER TABLE may copy the full table; on large tables, use ALGORITHM=INPLACE where possible.
Always make the migration idempotent. In many CI/CD pipelines, the same migration may run more than once. Use conditional clauses like ADD COLUMN IF NOT EXISTS to avoid breakage.