The error showed up after staging. The new column broke the build.
Adding a new column in a database table is not hard, but doing it in a live system with zero downtime takes precision. A single misstep can lock the table, block writes, or trigger cascading failures. Schema changes are code changes. They deserve the same discipline, review, and deployment strategy as application logic.
Before creating the new column, check constraints, indexes, and data types. Choose defaults carefully. A non-null column with no default will fail on insert for existing rows. Avoid heavy transformations in a single step; migrate in phases to limit risk.
For large tables, add the new column with minimal locking. Use tools like gh-ost, pt-online-schema-change, or built-in non-blocking DDL. Test the migration path on a clone of production data. Measure execution time and lock impact.