Heroku pg: do not retrieve tables from heroku database

I am trying to pull the heroku database to my local windows machine using the heroku bash command

heroku pg:pull HEROKU_POSTGRESQL_COLOR mydatabase --app appname,

when I execute the command above, I get the following error:

'env' is not recognized as an internal or external command, operating program, or batch file.!

But a local database is created 'mydatabase', but without any tables.

There is a table in my heroku application database, but it does not get into my local database.

Help me solve this problem.

+1
source share
2 answers

few things:

1. , "env" , , " , env. .

Env , unix. , Windows. "git bash". ( , CLI Heroku).

unix- , env, heroku pg: pull.

2. , , , . , Heroku, :

" pg: push - pg_dump pg_restore. - , , , - . cmd.exe(The Command Prompt, ). heroku.

heroku config:get DATABASE_URL

/ /databasename , : postgres:// : @_: port/databasename. . heroku .

pg_dump --verbose -F c -Z 0 -U username -h hostname -p port databasename > heroku.dump

. , , , - , , pg_restore. , CLI, , .

pg_restore --verbose --no-acl --no-owner  -h localhost -p 5432 -d mydb2 < heroku.dump

, , , . pg, , , , ".

+2

, , heroku, , ..

$heroku addons:add pgbackups

$ heroku pgbackups:capture
$ curl -o latest.dump `heroku pgbackups:url`

 wget "`heroku pgbackups:url --app app-name`" -O backup.dump

: ( )

: "env" , .!

, PATH . , WINDOWS\system32.

, :

  • p > >
  • PATH
0

Source: https://habr.com/ru/post/1535419/


All Articles