我在使用 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/