gunpowderlabs / buildpack-ruby-rake-deploy-tasks

Run arbitrary rake tasks on deploy to Heroku
MIT License
146 stars 79 forks source link

Running db:migrate fails on first deploy #11

Open chrisroos opened 8 years ago

chrisroos commented 8 years ago

I ran into this problem when deploying a new instance of a Rails app that uses this buildpack to run migrations on deployment. The database doesn't appear to be available when it's first deployed/compiled. See https://gist.github.com/chrisroos/57b7c4d7750cdbc0fb96a131403526da for the output.

Have you come across this before, and if so have you found a workaround?

As an aside, while investigating this problem I came across Heroku Release Phase which seems suited to running these sort of tasks (rake db:migrate) after a successful deployment of the slug. Using this technique allows me to run the migrations after the first deploy. See https://gist.github.com/chrisroos/cb3f0d29f65823ad6bfa461756a95d44 for the output.