If you need to manipulate existing data when your code is deployed, there are two main ways to do it:
- Create a rake task to migrate the data after the code is deployed. This is ideal for more complex data migrations.
- Use ActiveRecord models in a migration. This is acceptable for smaller data manipulations.
Regardless of the method you use, make sure to test your migrations before submitting them.