Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top