Adding a new column to a database sounds simple. It isn’t, unless you respect the details. Schema changes touch live data, production performance, and application code. Done wrong, they corrupt rows or lock tables. Done right, they expand capabilities while keeping latency flat.
Start with the database type. In PostgreSQL, adding a new column with a default value rewrites the whole table unless you use ADD COLUMN ... DEFAULT ... with a zero-cost default like NULL. In MySQL, ALTER TABLE can block reads and writes unless you enable ALGORITHM=INPLACE or run it in a controlled maintenance window. For large datasets, use tools like pt-online-schema-change or built-in online DDL where supported.
Plan versioning across code and schema. First, deploy the new column as nullable and unused. Ship code that writes to it while still reading from the old schema. Once data is backfilled and verified, shift reads to the new column. Only then make it non-nullable or drop obsolete columns. Each step should be reversible.