The migration was almost done when the schema broke. A missing new column stopped everything.
A new column sounds simple. It is not. In production systems, creating one can trigger downtime, lock tables, or cause silent data drift. Whether you use PostgreSQL, MySQL, or a distributed database, adding a column must be precise.
The first step is choosing the column type. Match the data type to both current and future needs. Avoid generic types that force later conversions. Define constraints early. NOT NULL with a default value avoids null-padding costs but must be tested for large datasets.
Next, plan the migration path. Online schema changes should be standard for high-traffic systems. Use tools like pg_online or gh-ost to avoid blocking writes. Always deploy schema changes in staged rollouts. Add the new column in one release, populate it in the next, then make it required in a third.