« Back to Index
DB migrations
View original Gist on GitHub
DB migrations.md
Renaming or changing the type of a column
- Create a new column
- Write to both columns
- Backfill data from the old column to the new column
- Move reads from the old column to the new column
- Stop writing to the old column
- Drop the old column
Renaming a table
- Create a new table
- Write to both tables
- Backfill data from the old table to new table
- Move reads from the old table to the new table
- Stop writing to the old table
- Drop the old table
Adding a column with a default value
- Add the column without a default value
- Commit the transaction
- Backfill the column
- Add the default value