Problem: We need to rename a DB column, but we want to avoid a breaking change


Problem: We need to rename a DB column, but we want to avoid a breaking change.

Solution:
1. Add new column (Ticket 1)

2. Update all code to reference new column (Ticket 2)

3. Release. Now no code references the old column. 😀

4. Delete the old DB column (Ticket 3)
Oops, I omitted the data migration steps. Here’s the full process.

1. Create a new column
2. Write to both columns
3. Backfill data from the old column to the new column
4. Move reads from the old column to the new column
5. Stop writing to the old column
6. Drop the old column

View original on X