The migration finished, but the schema didn’t match the spec. A new column was missing.
Adding a new column should be simple. In practice, this is where many systems break. A small schema change can trigger downtime, lock contention, or failed deployments. The key is to handle it with precision so you never block reads or writes and never corrupt data.
A new column in a relational database changes the structure of a table. In MySQL or PostgreSQL, ALTER TABLE can block operations if not managed correctly. In high-traffic environments, this can cause user-visible latency. Using tools like pt-online-schema-change or ALTER ... ADD COLUMN with ONLINE options can avoid disruption.
Always define the new column with proper defaults if existing rows require it. If nullable, ensure dependent services handle null values before deploying. If you’re adding indexes with the column, split the operations: add the column first, backfill asynchronously, then create the index online to reduce lock time.