The migration is done, but there’s a gap in the table. You need a new column, and you need it without breaking production.
Adding a new column sounds simple. In reality, it demands precision. Schema changes lock tables if done poorly, trigger downtime at scale, and create sync issues between code and database. The goal is zero-impact updates that keep your data and application in sync.
Start with intent. Know exactly why the new column is needed. Define its data type, nullability, and default values. Decide if it will be populated on creation or via a backfill job. Sketch the migration steps before touching code.
Use migrations that are explicit and version-controlled. In PostgreSQL, ALTER TABLE ... ADD COLUMN is straightforward, but large datasets require careful handling. Add nullable columns first to avoid locking writes for long periods. Backfill data in small batches to prevent performance spikes. Only then add constraints or change nullability.