The table was broken. You needed a new column, and the system refused.
Adding a new column is one of the most common changes in databases, yet it’s one of the most dangerous if done wrong. Schema changes can lock tables, block writes, and flood logs with errors. In high-traffic production systems, a poorly executed ALTER TABLE turns into downtime.
A new column is more than a name and type. You must consider nullability, default values, indexing, and migration strategy. The choice between NULL, NOT NULL, and default values affects query plans and performance. Adding an index to the new column can speed lookups but slows inserts. Every change ripples through replication, caching, and application code.
For relational databases like Postgres or MySQL, the safest path is a backward-compatible migration. First, add the column with a nullable type. Then deploy code that writes to the column. Populate it in batches to avoid long locks. Once filled, enforce constraints. This staged approach reduces the risk of blocking writes and keeps both old and new code functional during rollout.