Heroku won't reset my database-Collection of common programming errors
I have been trying to run $ heroku pg:reset from the command line but I believe I’m not putting in the database correctly. I’ve tried a number of variations.
I ran $ heroku config | grep POSTGRESQL to get the database name which prints as
HEROKU_POSTGRESQL_PINK_URL: postgres://naknaswvxfvuup:QK2dHYNMZ_va10lDgMDo4S0BIM@ec2-23-21-161-255.compute-1.amazonaws.com:5432/db7eute4gu4mcb
I’ve tried running everything from
#1 $ heroku pg:reset HEROKU_POSTGRESQL_PINK_URL: postgres://naknaswvxfvuup:QK2dHYNMZ_va10lDgMDo4S0BIM@ec2-23-21-161-255.compute-1.amazonaws.com:5432/db7eute4gu4mcb
#2 $ heroku pg reset postgres://naknaswvxfvuup:QK2dHYNMZ_va10lDgMDo4S0BIM@ec2-23-21-161-255.compute-1.amazonaws.com:5432/db7eute4gu4mcb
#3 $ heroku pg:reset db7eute4gu4mcb
and other variations. Please let me know how to correctly note this as I keep getting either an error or this text from the commmand line ” ! Unknown database: db7eute4gu4mcb. Valid options are: DATABASE_URL, HEROKU_POSTGRESQL_PINK_URL”
I’m currently at 10.4 on the Ruby on Rails tutorial. Thanks!
-
You should specify a DATABASE when run
heroku pg:reset
. This is the syntax:heroku pg:reset
To know the value of , you can run:
heroku pg:info
It will return DATABASE_URL, something like: HEROKU_POSTGRESQL_GRAY_URL
Then you can reset your database:heroku pg:reset HEROKU_POSTGRESQL_GRAY_URL
In your case, to reset database run:
heroku pg:reset HEROKU_POSTGRESQL_PINK_URL
-
Assuming you have your authentication information exported to the shell environment, you should be fine with just passing the name of the database. For example:
PGPASSWORD='foobarbaz' export PGPASSWORD heroku pg:reset pink
There are certainly other ways to use the reset command, but IMHO this is the easiest.
Originally posted 2013-11-09 23:21:33.