One time rake task or a migration

Sometimes we need to fix data. There are two ways we can handle this. We can write a rake task that would be executed only once. Or we can write a migration.

If we write a one time rake task then we need to remember to execute it after the deployment. Sometimes we forget to run those rake tasks. Secondly there is an additional burdern of communicating to the team that after the deployment execute the rake task.

If we write a migration to fix data then there is additonal burden of communication. However some folks do not like data fixes as migrations. They believe that migrations should only contain schema changes and not data changes.

This topic is controversial and has been debated many times before.

At BigBinary most of our applications are configured to automatically deploy when a PR is merged to master. In such an environment using rake taks becomes quite cumbersome. Hence at BigBinary we choose to use migration to fix data.