The migration finished at 03:24 UTC, but something was wrong—data in the reports table refused to match the logs. The fix came down to a single operation: add a new column.
A new column changes the shape of your data model. Done right, it extends your schema without breaking existing queries. Done carelessly, it triggers downtime, data loss, or failed deployments. Whether in PostgreSQL, MySQL, or a distributed SQL engine, the steps remain precise: define the column type, set the default values (if any), and update dependent code paths before release.
In PostgreSQL, adding a new column with ALTER TABLE is fast for most data types without a default. A NOT NULL with default backfills every row, which can lock writes and spike IO. MySQL behaves differently; adding columns to large tables often requires careful planning or tools like pt-online-schema-change. For distributed databases, adding schema fields can require versioned migrations and phased rollouts to avoid cluster-wide locks.