Blogmark
Data migrations with the `maintenance_tasks` gem
via jbranchaud@gmail.com
https://railsatscale.com/2023-01-04-how-we-scaled-maintenance-tasks-to-shopify-s-core-monolith/article.html
Ruby on Rails
Databases
Data Migrations
The maintenance_tasks
gem from Shopify is a mountable Rails engine for running one-off data migrations from a UI that is separate from the schema migration lifecycle.
In the past, I've used the after_party
gem for this use case. That gem runs data migrations tasks typically as part of a post-deploy process with the same up/down distinction as schema migrations.
It seems the big difference with maintenance_tasks
is that they are managed from a UI and that there are many more features, such as batch, pausing, rerunning, etc. You can observe the progress of these tasks from the UI as well.
There is a Go Rails Episode about how to use the maintenance_tasks
gem.