Setting Up Heroku PostgreSQL
Follow the next given steps for setting up Heroku PostgreSQL:
Step 1: Log in to your Heroku account. If you do not have a Heroku account, create one and log in.
Step 2: After logging in, click on the ‘New’ button on the top right corner of the page as shown in the image below:
Step 3: Then create a new app with a unique app name of your own.
Step 4: After the successful creation of the app, go to the resource tab as shown below:
Step 5: Search for Postgres in the add-on section and select the option titled ‘Heroku Postgres’ from the results
Submit the order form and move to the next step.
Step 6: Now, click on the ‘Heroku Postgres’ link that has now appeared on the screen.
Step 7: Click on the settings tab and then click on view credentials. This step includes settings related to the Heroku Postgres.
After that, you can see an interface similar to the one shown below, click on view credential.
Step 8: Now we can see the credentials required to complete our task there are also other credentials provided for further use. Copy the URI credential for the next step given below.
Connecting to Heroku Postgresql using TablePlus
TablePlus is a database management tool that provides a simple and easy-to-use GUI for creating tables and other queries of SQL to manage databases in an efficient manner.
Step 1: Open TablePlus and click on the ‘Create a new connection….’ option as shown in the GUI image.
Step 2: Now, get an interface similar to the image given below. Click on Import from URL For the next step of our task.
Step 3: Now paste the URL credential we copied earlier and click on the import button.
Note: There is a line break in the copied URL so hit the delete key once to remove that break in the copied URL and then click on import.
Step 4: Now provide a suitable name to your database check all provided details and then click on the test button given below.
If all fields are correctly filled it will show green marks on fields then click on save and move towards the next step.
Step 5: Now double-click on the database that we created earlier and is now visible on the TablePlus Dashboard
Creating a table
Step 1: Now we can see the Dashboard of TablePlus where we can now finally create our table in Heroku Postgres.
Step 2: Now in the left corner, we get two options: functions & tables.
Click on Tables -> New -> Table to create a table.
Step 3: Now click on the option shown in the image below to create tables.
Finally, our table has been created successfully you can change or add any of the constraints for the table regarding to the use of that particular table in projects you can also perform various operations on the table.
How to Create Tables on Heroku Postgresql
Heroku is a Platform as a Service (PaaS) used by developers to deploy their projects with different other requirements provided by the platform like database and all, whereas PostgreSQL is an open-source object-relational database system used for database management in many projects.
This article is going to show you how to create a table in Heroku PostgreSQL.
We are going to use the following technologies in this article:
- Heroku
- PostgreSQL
- Table Plus
Please note that this article assumes you to have a basic understanding of SQL queries and requires you to have a Heroku account.