Heroku postgres not found

白昼怎懂夜的黑 提交于 2019-12-13 14:28:11

问题


When I go to my Apps in Heroku and check the resources I can see Postgresql

but when I run from my computer pg:info I get the following:

$ heroku pg:info
! Resource not found

or this:

$  heroku pg:wait 
!    Resource not found

although when I run pg:credential I do get an output:

$ 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"

I have tried running heroku run rake db:migrate, heroku run db:reset and all fail. I get the errors:

could not connect to server: Connection refused
Is the server running on host "localhost" and accepting
TCP/IP connections on port 5432?

Going to the settings through the heroku web, I can see the following:

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 has DATABASE_URL and HEROKU_POSTGRESQL_PINK_URL set.

I have erased the production section of database.yml as I understand Heroku creates its own database.yml

I just migrated to ruby 2.0 and rails 4.0

how should I connect to the database? I thought this was supposed to be automatic. Thanks


回答1:


Solved this by downgrading Rails and Ruby :(

Now I'm using rails 3.1.0 and ruby 1.9.3




回答2:


Seems like the issue is with an outdated heroku toolbelt version. I was using v2.19.2.

Installing heroku toolbelt via ruby gems is deprecated, best thing to do is uninstall heroku gem $ gem uninstall heroku and reinstall the toolbelt the prefered way, depending on your platform: https://toolbelt.heroku.com/



来源:https://stackoverflow.com/questions/15667551/heroku-postgres-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!