I have a local Postgres database associated with an app on my local machine, and I would like to copy that database to the Heroku deployment of the app.
I tried:
heroku pg:push localdatabasename DATABASE_URL --app my-appname-23895
Here, I'm actually using the words DATABASE_URL
, because listing my environment variables via heroku config
shows that this is the name of the variable holding the database url, and not a color identifier like HEROKU_POSTGRESQL_YELLOW
.
Heroku responds with:
heroku-cli: Pushing localdatabasename ---> postgresql-identifier-83435
and then freezes there without returning to the bash prompt. If I open another bash window and log into Heroku Postgres with heroku pg:psql
, then when I examine the table structure with \dt
I get:
Did not find any relations.
Then when I go back to the bash window where I'm running heroku pg:push
, I press Ctrl+C to quit, and then I get the error message:
pg_dump errored with 3221225786
or
pg_restore errored with 3221225786
Not sure if the appearance of both pg_dump
and pg_restore
means it's just extremely slow to push the database and I should just keep waiting for a longer time for heroku pg:push
to finish, or if there's a problem with the push process. I've had it running for over 3 hours with no apparent change.
I also tried:
PGUSER=username PGPWD=password heroku pg:push localdatabasename DATABASE_URL --app my-appname-23895
and got the same results.
Instead of using pg:push
, I used pg:dump
followed by heroku pg:backups:restore
, per the solution described here.