Heroku模式负载:数据库的权限被拒绝“postgres”用户 [英] Heroku Schema load: Permission denied for database "postgres" User

查看:138
本文介绍了Heroku模式负载:数据库的权限被拒绝“postgres”用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将我的Rails应用程序部署到Heroku,现在我想加载我的模式。我得到以下错误:

I'm trying to deploy my Rails app to Heroku, and I now want to load my schema. I get the following error:

Running `bundle exec rake db:schema:load` attached to terminal... up, run.1533
rake aborted!
PG::ConnectionBad: FATAL:  permission denied for database "postgres"
DETAIL:  User does not have CONNECT privilege.

这很奇怪,因为 postgres 不是它应该连接到的数据库。应用程序可通过ENV获得的数据库URL具有正确的值,并且显然是随机的长名 d3kwlkwlwjwljetc ...

Which is weird because postgres is not the database it should connect to. The database URL, which is available to the app via ENV, has the right values, and the long apparently random name d3kwlkwlwjwljetc....

搜索这条消息给了我试图删除或重置数据库的人,这不是我正在做的事情。

Searching for this message gives me people who are trying to drop or reset the DB, which is not what I'm doing.


  • 我有0行

  • 我试过 pg:reset ,甚至删除并放回数据库。 code>

  • I have 0 rows
  • I tried pg:reset, even removed and put back the database. No avail.
  • I'm not doing db:drop, just db:schema:load

我傻眼了。为什么不能连接我的应用?

I'm dumbfounded. Why can't my app connect?

编辑:显然,我不能 schema:load ,但是我可以迁移我的所有迁移。为什么会这样?

Apparently, I can't schema:load, but I can migrate all my migrations over. Why is that?

推荐答案

看来这是Rails本身的一个问题 - 在 https://github.com/rails/rails/issues/17945 - 似乎有一个提交( https://github.com/ rails / rails / blob / master / activerecord / lib / active_record / tasks / postgresql_database_tasks.rb#L77 )连接到Heroku不允许的posgres数据库,因此失败。

It appears that this is an issue in Rails itself - there is a discussion regarding it at https://github.com/rails/rails/issues/17945 - it seems that there's a commit (https://github.com/rails/rails/blob/master/activerecord/lib/active_record/tasks/postgresql_database_tasks.rb#L77) that is connecting to the posgres database which isn't permitted on Heroku so fails.

总之,现在使用db:migrate直到问题解决。

In short, for the moment use db:migrate until the issue is resolved.

这篇关于Heroku模式负载:数据库的权限被拒绝“postgres”用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆