The tables were stable. Then comes the request: add a new column.
A new column is never just a simple addition. It changes queries, indexes, migrations, and sometimes the logic that drives your entire system. Whether you’re working in PostgreSQL, MySQL, or a distributed NoSQL store, the core challenge is the same—preserve data integrity while extending the structure.
In SQL databases, adding a column can be done with an ALTER TABLE statement. This is fast when the table is small, but in production with millions of rows, you need to think about locking, write blocking, and the cost of backfilling data. Long-running migrations can grind API responses to a halt if you execute them without planning.
To mitigate downtime, consider creating the new column as nullable, roll out code that writes to it, and then backfill asynchronously. Once backfilled, add constraints or defaults in a second migration. In PostgreSQL, using ADD COLUMN ... DEFAULT ... can rewrite the table; to avoid that, set the default at the application level until the backfill completes.