The schema is done. The API is fast. But the product team asks for one more thing: a new column.
Adding a new column sounds simple. It rarely is. You change the schema in one place, but the data lives across environments, services, and caches. Migrations must be safe. Queries must stay performant. Indexes may need updates. Each missed dependency is a bug waiting to crash production.
First, define the new column in the database schema. Choose the right data type and constraints. Avoid nullable fields unless necessary. If it will be filtered or sorted often, consider multi-column indexes early to prevent slow queries.
Second, plan the migration path. Use database migrations that can run without downtime. For large datasets, backfill in batches to reduce load. Monitor query performance during the change. In event-driven systems, ensure producers and consumers handle the new column gracefully before rolling it out globally.