Created
June 27, 2018 04:43
-
-
Save agmezr/f391efc1047099ec4db25fd0c673aacd to your computer and use it in GitHub Desktop.
Useful commands for heroku and postgres
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A collection of commands I found useful while deploying a postgres database. | |
# To avoid specifing the app use the commands on the path where your heroku app is located | |
# To enable postgres add-no | |
heroku addons:create heroku-postgresql:<PLAN_NAME> | |
# Create backup | |
heroku pg:backups:capture | |
# List backups | |
heroku pg:backups | |
# Restore herroku app from dump | |
heroku pg:backups:restore <DUMP NAME> <DATABASE_URL> | |
# Enter postgres-cli | |
heroku pg:psql | |
# Obtain url for primary database | |
heroku pg:credentials:url DATABASE | |
# For running a script to the postgres database, useful to seed the primary db | |
cat path/to/script/file.sql | heroku pg:psql | |
# View various info like pg version and size | |
heroku pg:info |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment