- Heroku CLI is already installed on your machine.
- Make sure that you're logged in. If not, run
heroku login
. You will be prompted to enter your login credentials in the browser.
You only need to execute a couple of commands to get things done. The first command will push your latest changes to your Heroku app. The second command will apply new database migrations to your heroku app.
If you're working on a Git branch other than main
, run the following:
git push heroku ${LOCAL_BRANCH NAME}:main
Otherwise, just push to main
.
git push origin main
We can now apply new database migrations.
heroku run rake db:migrate
Refer to this GitHub gist for details. Run the following commands:
heroku restart
heroku pg:reset $DATABASE_NAME --app twitter-rails-api
heroku run rake db:migrate
heroku run rake db:seed
Make sure to replace $DATABASE_NAME
with the database named automatically
configured by Heroku for you.
Just go to Heroku → App (twitter-rails-api) → Resources → Heroku Postgres → Settings → Database Credentials → View Credentials. From there, you can copy the custom command (see the Heroku CLI for details).