将本地PostgreSQL数据库推送到远程Heroku服务器

use*_*014 7 postgresql batch-file heroku environment-variables

在Windows 7上,我想将我的本地PostgreSQL数据库(9.4.0)推送到Heroku上的远程PostgreSQL服务器(9.3.3),我按照Heroku PostgreSQL文档推送:

>heroku pg:push postgres HEROKU_POSTGRESQL_NAVY_URL --app salty-atoll-4222

Your version of git is 1.9.5.. Which has serious security vulnerabilities.
More information here: https://blog.heroku.com/archives/2014/12/23/update_your_git_clients_on_windows_and_os_x
'env' is not recognized as an internal or external command,
operable program or batch file.
Password:
 !    WARNING: Extensions in newly created target database differ from existing source database.
 !
 !    Target extensions:
 !     extname
 !    ---------
 !     plpgsql
 !    (1 row)
 !
 !
 !    Source extensions:
 !      extname
 !    -----------
 !     adminpack
 !     plpgsql
 !    (2 rows)
 !
 !
 !    HINT: You should review output to ensure that any errors
 !    ignored are acceptable - entire tables may have been missed, where a dependency
 !    could not be resolved. You may need to to install a postgresql-contrib package
 !    and retry.
Run Code Online (Sandbox Code Playgroud)

我的本地数据库服务器URL是localhost:5432.无论是用户名和数据库名称是postgres,我已经添加PGUSERPGPASSWORD我的系统变量,另外,我的DATABASE_URL系统变量postgres://postgres:password@localhost:5432/postgres.

此外,因为它说'env' is not recognized as an internal or external command, operable program or batch file.,我猜set命令可以使用来代替env,所以我还增加了一个别名env.batC:\Windows\System32\env.bat:

@ECHO OFF
set
Run Code Online (Sandbox Code Playgroud)

但它仍然无法识别env命令和我的PGPASSWORD变量,要求我手动输入我的密码,显示相同的警告,我的数据库无法推送到这个远程服务器.这有什么问题?

rav*_*ode 2

在 Windows 上,ENV变量需要在 Heroku 上进行不同的配置,如果您已经尝试过此操作,我在您的问题中看不到:

heroku config:set GITHUB_USERNAME=joesmith
Adding config vars and restarting myapp... done, v12
GITHUB_USERNAME: joesmith

$ heroku config
GITHUB_USERNAME: joesmith
OTHER_VAR:    production

$ heroku config:get GITHUB_USERNAME
joesmith

$ heroku config:unset GITHUB_USERNAME
Unsetting GITHUB_USERNAME and restarting myapp... done, v13
Run Code Online (Sandbox Code Playgroud)

更多相关文档可以在这里找到。