I want to destroy the database but I'm not sure what the command would be. Does anyone know how to do this?
4 Answers
You shouldn't use a postgres command to fully delete your database, as you will not have permissions to create a new one. Instead you should use the heroku command to clear out your database:
heroku pg:reset DATABASE_URL
5 Comments
heroku pg: reset DATABASE_URL, DATABASE_URL is an environ config and points to your db url, heroku knows how to read it, so just type it in exactly like that and it works.None of the answers above actually describe how to destroy a Heroku database, which was the original question (and what led me here seeking an answer).
From their docs, either of these will work:
heroku addons:destroy heroku-postgresql:tier(wheretieris the database tier, likehobby-dev)heroku addons:destroy HEROKU_POSTGRESQL_<COLOR>(if you have more than one database of that tier)
Note that because this is a destructive action it will prompt you to confirm the action. If you want to use this in a script you can skip the prompt with something like this:
heroku addons:destroy HEROKU_POSTGRESQL_<COLOR> --confirm <appname>
Hope that's helpful!