【问题标题】:Push local PostgreSQL database to remote Heroku server将本地 PostgreSQL 数据库推送到远程 Heroku 服务器
【发布时间】: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,我已经将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,所以我还在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\cmd Heroku。卸载 Heroku 时不会撤消对系统环境变量的修改。环境变量HerokuPathPATH 在您的机器上定义的路径是否相同?
  • 我认为您不需要远程 URL,只需要名称即可; heroku 应该为你解决这个问题。此外,您能否确认推送不起作用?即,目标中缺少表/数据。从问题中不清楚问题是数据是否丢失,或者您是否对消息感到困惑(根据我的阅读,这表示警告,但不是错误)。

标签: postgresql batch-file heroku environment-variables


【解决方案1】:

在 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

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

【讨论】:

  • @user3684014 你试过了吗,错误是否保持不变?谢谢!
猜你喜欢
  • 2023-03-06
  • 2020-11-08
  • 2013-12-09
  • 2011-06-01
  • 2013-04-05
  • 2015-10-23
  • 1970-01-01
  • 1970-01-01
  • 2011-07-29
相关资源
最近更新 更多