The migration stalled. The query hung, blocked by a missing field that should have existed all along. You need a new column.
In relational databases, adding a new column is one of the most common schema changes. It can be deceptively simple, yet dangerous if executed without care. Whether you use PostgreSQL, MySQL, or a cloud-managed database, the approach must balance speed, safety, and backward compatibility.
A standard ALTER TABLE command can lock rows and block writes if the dataset is large. Engineers working with production workloads avoid downtime by using strategies like online schema change tools, transactional migrations, or phased rollouts. In PostgreSQL, adding a new nullable column with a default avoids immediate rewriting of the table. In MySQL, ALTER TABLE ... ADD COLUMN with ALGORITHM=INPLACE can reduce impact, but not in all cases. Understanding the database’s capabilities is critical before execution.
Schema evolution requires planning around code deployment. First, add the new column without populating values. Ensure the application can handle nulls. Next, backfill data in batches to control load on the database. Finally, deploy the application code that writes to and reads from the new column. This sequence prevents runtime errors and keeps the migration safe under traffic.