Adding a new column to a production database is simple in theory—one migration, a quick ALTER TABLE. In practice, it is a minefield of locks, data integrity checks, and downstream dependencies. The wrong move can stall queries, cause service degradation, or break API contracts.
First, define the new column in your schema with precision. Set the correct data type, constraints, and defaults before it ever touches production. Avoid adding NOT NULL without a default unless you prefill the data in a staged migration. This prevents full table rewrites on large datasets.
Second, never run migrations blind. Test the change in a cloned environment using production-like data. Measure query plans before and after. Identify whether the ALTER TABLE will trigger a lock that blocks reads or writes. On large relational databases like Postgres or MySQL, adding columns can be near-instant—or it can freeze traffic for minutes—depending on the version and table layout.