When you can't take downtime, the “trick” to data migration is: Think small changes.
- New table
- Update writes to go to old and new
- Background job to migrate old data to new
- Move reads to new table
- Stop writing to old table
Each of these steps is a deploy.
Top comments (6)
This tip is 🔥!
For Rails apps, I love using the strong_migrations gem to encourage small, safe steps like these.
I would recommend checking LHM out if you're on rails. We have used it for multiple major migrations and it works like a charm.
See on 2. Write to both tables
Oh sorry, I thought it only writes to new one