Heroku & pgAdmin.

Julia
3 min readJan 10, 2021

This article is about ‘after-deployed’ process. You should have your app with PostgreSQL Database deployed on Heroku already. I have a blog post about deploying an app to Heroku, so if you are not there yet here is the link.

As a creator and an admin of your app you definitely need a way to access and manage your db. You can easily access to your DB from Heroku site:

  • Heroku/Personal. Click on your App name.
  • Go to resources tab and you will see adds-on.
  • Click to Heroku Postres add-on.
  • Go to Dataclip tab and click Create Dataclip

Here you can see your schema (on the right) and you can write query statement (on the left).

Unfortunately the DataClip feature made read-only. So only SELECT statements work !!!! Its a reporting tool, not a database management tool. This way a large group of people associated with a project can have access to DB without the risk of someone accidentally deleting or modifying data improperly. There is no way to make Dataclips read and write. If you want to have a full control (delete/modify data) you’ll need to use pgAdmin.

Setting up pgAdmin for your Heroku app.

Step 1.

Get pgAdmin credentials from Heroku:

  • Heroku/Personal. Click on your App name.
  • Go to resources tab and you will see adds-on.
  • Click to Heroku Postres add-on.
  • Go to Setting tab and click View Credentials

Step 2.

Go to your pgAdmin ( I assume you already installed it).

  • Create new server.
  • On the opened tab fill all necessary info. In General tab— any name for your server.
  • In Connection tabhost name, port, DB name and username. They are your credentials from Step 1 !!!

So now if you open your just created server on pgAdmin you will see a huge list of all available databases on Heroku. There is no need to scroll down and look for your db. There is a better way: to hide all databases except of the one you need!! Right click on your server and go to properties:

In DB restriction type in the name of your database enclosed in single quotes (example: ‘dblnk447’). One more time: the name you can find in your credentials from Step 1.

This is it! Now you can manage your DB that connected to your Heroku app! By the way I have a detailed blog post how to work with pgAdmin and manage your DB.

Thank you for reading!

--

--