How to run rake db: do migration in automatic deployment using hero or api gem hero?

I use this in the rake task:

client = Heroku::Client.new('', 'heroku-api-key') client.rake 'my-app-name', 'db:migrate' 

and all i get is

RestClient :: UnprocessableEntity: 422 Unprocessable Entity.

Other commands work, for example

 client.ps('my-app-name') 

Client.rb uses the hero

 rake(app_name, cmd) 

so I'm not sure what happened. I see no way to debug the response even when using RESTCLIENT_LOG = stdout.

+4
source share
2 answers

If you export your API key, you can run the heroku command line without requiring a script API:

 export HEROKU_API_KEY=<your key> heroku run bundle exec rake db:migrate 
0
source

A little late, but try this if you do not understand it.

heroku run bash and then

rake db:migrate , as you would do on your local machine

0
source

Source: https://habr.com/ru/post/1433885/


All Articles