ruby-on-rails - Heroku 数据库设置

标签 ruby-on-rails postgresql heroku

我在使用 heroku run rake db:create 时遇到以下问题

在RubyonRails技术和Postgresql数据库中的应用。

This is the legacy Heroku CLI. Please install the new CLI from https://cli.heroku.com
Running rake db:create on ⬢ project-name... up, run.2367 (Free)
FATAL:  permission denied for database "postgres"
DETAIL:  User does not have CONNECT privilege.
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "pool"=>5, "database"=>"abcdabcd", "username"=>"abcdabcd", "password"=>"abcdabcd", "port"=>5432, "host"=>"ec2-107-21-233-71.compute-1.amazonaws.com"}
rake aborted!
PG::ConnectionBad: FATAL:  permission denied for database "postgres"
DETAIL:  User does not have CONNECT privilege.

你能告诉我在这个应用程序中我缺少什么配置吗?

提前致谢。

最佳答案

你不能在 heroku 上运行 db:create。相反,您需要提供 postgresql add-on . 这样做会为您创建一个数据库,并将其凭据作为 DATABASE_URL 环境变量提供给您。

然后您可以运行 db:migrate 来设置所有表。
另见 https://devcenter.heroku.com/articles/heroku-postgresql

关于ruby-on-rails - Heroku 数据库设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52497078/

相关文章:

ruby-on-rails - 将 Rails 应用程序从 1.8.7 升级到 ruby​​ 1.9.3

ruby-on-rails - 如何将现有源代码推送到 github 中的存储库?

ruby-on-rails - "You are trying to cache a Ruby object which cannot be serialized to memcached."

postgresql - 如何使用具有指定运算符的现有索引添加排除约束?

ssl - 如何使用 Heroku SSL 配置委托(delegate) SSL 证书

ruby-on-rails - Rails 3 Devise 停止使用更多加密 "stretches"

postgresql - 在postgresql中划分大数

sql - 如何在单个查询中对 child 和 parent 进行分组?

python - 如何使用 Django 自动将 heroku 应用程序 URL 重定向到我的自定义域?

ssl - Route 53 裸域/根域别名记录