Heroku数据库设置

时间:2018-09-25 11:26:10

标签: 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.

您能告诉我我在此应用程序中缺少哪些配置吗?

谢谢。

1 个答案:

答案 0 :(得分:2)

您无法在heroku上运行db:create。相反,您需要配置postgresql add-on。 这样做将为您创建一个数据库,并为您提供DATABASE_URL环境变量的凭据。

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