当我进入Heroku中的应用程序并检查资源时,我可以看到Postgresql,但是当我在我的电脑上运行pg:info时,我得到以下信息:
或者这样:
虽然当我运行pg:credential时,确实会得到输出:
我尝试运行
通过Heroku网站进入设置,我可以看到以下内容:
$ heroku pg:info
! Resource not found
或者这样:
$ heroku pg:wait
! Resource not found
虽然当我运行pg:credential时,确实会得到输出:
$ heroku pg:credentials HEROKU_POSTGRESQL_PINK
Connection info string:
"dbname=some_name host=ec2-107-22-165-15.compute-1.amazonaws.com port=5432 user=some_user password=some_password sslmode=require"
我尝试运行
heroku run rake db:migrate
和heroku run db:reset
,但都失败了。我收到以下错误信息:could not connect to server: Connection refused
Is the server running on host "localhost" and accepting
TCP/IP connections on port 5432?
通过Heroku网站进入设置,我可以看到以下内容:
Connection Settings : Default
Host ec2-107-22-165-15.compute-1.amazonaws.com
Database some_databasename
User some_user
Port 5432
Password some_password
Statistics
Plan Dev
Status available
Data Size 5.9 MB
Tables 0
PG Version 9.1.8
Created March 27, 2013 18:01
heroku config
已经设置了DATABASE_URL和HEROKU_POSTGRESQL_PINK_URL。
我删除了database.yml
中的production
部分,因为我知道Heroku会创建自己的database.yml
我刚刚迁移到了ruby 2.0和rails 4.0
我该如何连接数据库?我以为这应该是自动的。谢谢。