I'm using a pipeline for my rails app on Heroku. I have a staging app, which is then promoted to a production app. I run any schema migrations before deploying to staging and the slug is then moved to production when I promote it.
But now need I to migrate some user data on my next deploy, and I'm looking for a way to do this as part of the promotion. I could always run a rake task when the promotion is complete, but that seems very risky. Ideally, the code should run before the app is released, and rollback if anything goes wrong.
I thought that Release Phases were the answer, but I don't think I can access user data there, given these considerations.