Rake Migrate Not Running in Production

I can’t find any trace of rake db:migrate running for the production env in the circle ci UI. I have to manually run heroku rake db:migrate to fix it. I am using a simple circle config allowing it to infer 100% of everything. I’ve tried to override the database with commands and override but it doesn’t seem to help.

P.S. I love circle CI. Fantastic product.

deployment:
production:
branch: master
heroku:
appname: jobfriender
#database:

override:

- bundle exec rails db:create

- bundle exec rails db:migrate

- bundle exec rails db:migrate RAILS_ENV=test

I got it to work. I had to add the git push command right before the migrate command like this…

deployment:
production:
branch: master
commands:
- git push git@heroku.com:jobfriender.git $CIRCLE_SHA1:refs/heads/master
- heroku run rake db:migrate --app jobfriender
staging:
branch: staging
commands:
- git push git@heroku.com:jobfriender.git $CIRCLE_SHA1:refs/heads/master
- heroku run rake db:migrate --app jobfriender

1 Like

Thank you for sharing your solution @nathantech2005!

Glad you got it working.

Best, Zak