Using an existing Heroku database

Let’s say you have an existing Heroku Postgres database with data in it, and you’d like add GraphQL on it.

Note

In case you’re exposing an existing database (esp. if it is production), please configure an access key for the console and the GraphQL endpoint.

Step 0: Deploy Hasura on Heroku

Deploy Hasura on Heroku by clicking on this button:

heroku_deploy_button

Follow the Heroku instructions to deploy, check if the Hasura console loads up when you View app and then head to the Manage App screen on your Heroku dashboard.

Step 1: Remove the existing Postgres addon in the app

Head to your Heroku dashboard and delete the Postgres addon:

../../../../_images/remove-heroku-postgres-addon.png

Step 2: Configure environment variables

Now configure the DATABASE_URL with your existing Heroku Postgres database URL and a HASURA_GRAPHQL_ACCESS_KEY if you want to secure your endpoint.

../../../../_images/heroku-database-url-access.png

Step 3: Track tables and relationships

Wait for the GraphQL engine to restart and you’ll see your existing tables as “untracked tables” in the console.

../../../../_images/TrackTable.jpg