The migration halted. A single change had broken the build. The root cause was simple: a new column.
Adding a new column to a database table is one of the most common schema changes in software. It looks trivial. It’s not. Done wrong, it causes downtime, data inconsistency, and broken deployments. Done right, it slips into production without impact. The difference is in planning and execution.
The first step is defining the new column in a way that avoids locking or blocking writes. On large datasets, this means avoiding default values that trigger full table rewrites. Instead, create the column as nullable, then backfill data in batches. Once complete, add constraints if needed.
Always apply the change through version-controlled migrations. Track every schema change in code, not in ad-hoc manual queries. This ensures a clear audit trail and repeatable deployments across environments.
Indexing the new column is often necessary for performance, but premature indexing can slow writes and cause deployment delays. Monitor query plans before deciding.