How do you access your heroku database (specifically postgres)?

流过昼夜 提交于 2020-01-06 02:51:10

问题


When I am developing locally, I'll just run a

rails c

and I can fire of queries at the console.

However, how can I query and access my postgres database that is up on heroku?


回答1:


You can run heroku run rails c --app <appname>. I will also add, if you want to view your database, you can make use of PG Commander https://eggerapps.at/pgcommander/ which actually automatically parses all the credentials out for you.

If you want to do this, run heroku config --app <appname> and then copy the DATABASE_URL. After you've done this, create a new favourite in your PG Commander and you'll see that it has already automatically filled in all the credentials based on what was in your clipboard.



来源:https://stackoverflow.com/questions/23506537/how-do-you-access-your-heroku-database-specifically-postgres

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