你如何访问你的heroku数据库(特别是postgres)? [英] How do you access your heroku database (specifically postgres)?

查看:137
本文介绍了你如何访问你的heroku数据库(特别是postgres)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在本地开发时,我会运行一个

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

rails c

我可以在控制台中激发查询。

and I can fire of queries at the console.

然而,我如何查询和访问我在heroku上的postgres数据库?

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

推荐答案

您可以运行 heroku run rails c --app< appname> 。我还会补充一点,如果你想查看你的数据库,你可以使用PG Commander https://eggerapps.at/

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.

如果你想这样做,运行 heroku config - app< appname> ,然后复制 DATABASE_URL 。完成此操作后,在您的PG Commander中创建一个新的收藏夹,您将看到它已经根据剪贴板中的内容自动填充了所有凭据。

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.

这篇关于你如何访问你的heroku数据库(特别是postgres)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆