Heroku Schema 加载:数据库 "postgres" 用户的权限被拒绝
Heroku Schema load: Permission denied for database "postgres" User
我正在尝试将我的 Rails 应用程序部署到 Heroku,现在我想加载我的架构。我收到以下错误:
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...
.
搜索这条消息让我看到那些试图删除或重置数据库的人,这不是我在做的事情。
- 我有 0 行
- 我试过
pg:reset
,甚至删除并放回数据库。没有用。
- 我不做
db:drop
,只是 db:schema:load
我傻眼了。为什么我的应用无法连接?
编辑:显然,我不能 schema:load
,但我可以将所有迁移迁移过来。这是为什么?
这似乎是 Rails 本身的一个问题——在 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 上有一个关于它的讨论,它正在连接到 Heroku 不允许的 posgres 数据库,所以失败了。
总之暂时使用db:migrate直到问题解决
我正在尝试将我的 Rails 应用程序部署到 Heroku,现在我想加载我的架构。我收到以下错误:
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...
.
搜索这条消息让我看到那些试图删除或重置数据库的人,这不是我在做的事情。
- 我有 0 行
- 我试过
pg:reset
,甚至删除并放回数据库。没有用。 - 我不做
db:drop
,只是db:schema:load
我傻眼了。为什么我的应用无法连接?
编辑:显然,我不能 schema:load
,但我可以将所有迁移迁移过来。这是为什么?
这似乎是 Rails 本身的一个问题——在 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 上有一个关于它的讨论,它正在连接到 Heroku 不允许的 posgres 数据库,所以失败了。
总之暂时使用db:migrate直到问题解决