Don't forget your rake tasks when performing migrations
Scenario
In my Rails appication I have defined two migration files to add new tables and define an index on a column.
To speed up the migration process, and minimize downtime, the migrations only created empty tables, and to populate these tables I defined dedicated rake tasks to run asynchronously after all migrations are applied and up.
After a while, I had to perform a rollback of these migrations to test their performance when applied. After doing that and taking measurements, when running the migrations again I thought I was finished with the task.
The problem
Sometimes later I visited a random page on the website and it was broken.
After inspecting the logs, I have found that indeed the page is broken because it is missing some data from the new tables.
I.e, the rake tasks were not run again after re-applying the migrations, and thus the view was not able to display it.