The migration was running fine until the schema stopped matching the data. You needed a new column, and nothing could move forward without it.
Adding a new column sounds simple. It isn’t. Schema changes can break deployments, block writes, and create downtime when done at scale. The cost of locking a large table to add a column can be massive in production environments. The wrong approach risks corrupt data, failed transactions, and angry users.
A new column in SQL alters the table definition. Whether in PostgreSQL, MySQL, or a distributed database, the command is straightforward:
ALTER TABLE orders ADD COLUMN status TEXT;
But under the surface, databases handle this process differently. Some engines rewrite the entire table on disk. Others store metadata changes instantly. The impact on query performance, replication lag, and backup processes depends on both the database and how the new column is defined—its type, default value, and constraints.