【发布时间】:2015-02-25 07:35:48
【问题描述】:
在 windows 7 上,我想将本地 PostgreSQL 数据库(9.4.0)推送到 Heroku(9.3.3)上的远程 PostgreSQL 服务器,我按照Heroku PostgreSQL Document 推送:
>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.
我的本地数据库服务器 URL 是 localhost:5432。用户名和数据库名都是postgres,我已经将PGUSER和PGPASSWORD添加到我的系统变量中,我的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,所以我还在C:\Windows\System32\env.bat中添加了一个别名env.bat:
@ECHO OFF
set
但它仍然无法识别env 命令和我的PGPASSWORD 变量,要求我手动输入密码,显示相同的警告并且我的数据库无法推送到此远程服务器。这里有什么问题?
【问题讨论】:
-
我不知道问题是什么,但我也遇到了几乎完全相同的问题,而且我也在 Windows 7 上。当然希望有人能回答...
-
我可以看到
heroku-toolbelt.exe将变量HerokuPath与值C:\Program Files (x86)\Heroku添加到系统环境变量列表中,并在安装时附加到系统环境变量PATH文件夹路径C:\Program Files (x86)\Heroku\bin;C:\Program Files (x86)\git\cmdHeroku。卸载 Heroku 时不会撤消对系统环境变量的修改。环境变量HerokuPath和PATH在您的机器上定义的路径是否相同? -
我认为您不需要远程 URL,只需要名称即可; heroku 应该为你解决这个问题。此外,您能否确认推送不起作用?即,目标中缺少表/数据。从问题中不清楚问题是数据是否丢失,或者您是否对消息感到困惑(根据我的阅读,这表示警告,但不是错误)。
标签: postgresql batch-file heroku environment-variables