Destroying Postgres Database on Heroku

I want to destroy the database, but I'm not sure what this command is. Does anyone know how to do this?

+51
postgresql heroku destroy
01 Oct '11 at 20:05
source share
4 answers

You should not use the postgres command to completely delete your database, as you will not have permission to create a new one. Instead, you should use the heroku command to clear the database:

heroku pg:reset DATABASE_URL 
+118
Oct 02 '11 at 16:53
source share

None of the answers above describe how to destroy the Heroku database, which was the original question (and what brought me here to find the answer).

From their documents , any of them will work:

  • heroku addons:destroy heroku-postgresql:tier (where tier is the database level, for example hobby-dev )
  • heroku addons:destroy HEROKU_POSTGRESQL_<COLOR> (if you have more than one database at this level)

Please note that since 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 this is helpful!

+19
Feb 19 '15 at 16:29
source share

To answer Siamii's question above: DATABASE in heroku pg:reset DATABASE default postgres

+8
Apr 02 '13 at
source share

Just follow these steps. Run

heroku pg:reset DATABASE

to recreate the database without anything, then run

heroku run rake db:migrate

to initialize the database using the correct schema and data.

Look at the new heroic documentation that helps;)

+5
Nov 11 '14 at 21:25
source share



All Articles