# Populate a postgreSQL database on Heroku

{% hint style="warning" %}
Please be sure of your agent type and version and pick the right documentation accordingly.
{% endhint %}

{% tabs %}
{% tab title="Node.js" %}
{% hint style="danger" %}
This is the documentation of the `forest-express-sequelize` and `forest-express-mongoose` Node.js agents that will soon reach end-of-support.

`forest-express-sequelize` v9 and `forest-express-mongoose` v9 are replaced by [`@forestadmin/agent`](https://docs.forestadmin.com/developer-guide-agents-nodejs/) v1.

Please check your agent type and version and read on or switch to the right documentation.
{% endhint %}
{% endtab %}

{% tab title="Ruby on Rails" %}
{% hint style="success" %}
This is still the latest Ruby on Rails documentation of the `forest_liana` agent, you’re at the right place, please read on.
{% endhint %}
{% endtab %}

{% tab title="Python" %}
{% hint style="danger" %}
This is the documentation of the `django-forestadmin` Django agent that will soon reach end-of-support.

If you’re using a Django agent, notice that `django-forestadmin` v1 is replaced by [`forestadmin-agent-django`](https://docs.forestadmin.com/developer-guide-agents-python) v1.

If you’re using a Flask agent, go to the [`forestadmin-agent-flask`](https://docs.forestadmin.com/developer-guide-agents-python) v1 documentation.

Please check your agent type and version and read on or switch to the right documentation.
{% endhint %}
{% endtab %}

{% tab title="PHP" %}
{% hint style="danger" %}
This is the documentation of the `forestadmin/laravel-forestadmin` Laravel agent that will soon reach end-of-support.

If you’re using a Laravel agent, notice that `forestadmin/laravel-forestadmin` v1 is replaced by [`forestadmin/laravel-forestadmin`](https://docs.forestadmin.com/developer-guide-agents-php) v3.

If you’re using a Symfony agent, go to the [`forestadmin/symfony-forestadmin`](https://docs.forestadmin.com/developer-guide-agents-php) v1 documentation.

Please check your agent type and version and read on or switch to the right documentation.
{% endhint %}
{% endtab %}
{% endtabs %}

## Populate a postgreSQL database on Heroku

{% hint style="info" %}
If you don't have a Heroku application yet, take a look at [this how-to](https://docs.forestadmin.com/documentation/extra-help/setup/deploy-to-production-on-heroku).
{% endhint %}

We recommend adding on your Heroku application the free add-on “Heroku Postgres” **(1)(2)**.

![](https://2014605362-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LR7SWfEwsNtj_ZiSkSA%2F-LcReDOJuWFYbOxCoB94%2F-LcRfS5k-MxHhHnpKDpO%2Fdeploy%20heroku%204.png?alt=media\&token=9cdf9e8d-dfbd-4545-b5e8-4d759848b059)

Once installed, your Heroku application will contain an environment variable `DATABASE_URL` with the credentials of your new created database **(1)** in the “Config Vars” section **(2)**. Here you can add more if necessary **(3)**.

![](https://2014605362-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LR7SWfEwsNtj_ZiSkSA%2F-LcRbS2o_yhoRteQvUFv%2F-LcRcBP4xM0FzUDDtTyQ%2Fdeploy%20heroku%205.png?alt=media\&token=47c4a73b-ada4-4bc9-a6aa-eebcf926e3ae)

Your new database has no data yet, so you will need to import your local data to this new one.

To do that, you first need to create a dump of your local database.

```
PGPASSWORD=secret pg_dump -h localhost -p 5416 -U forest forest_demo --no-owner --no-acl -f database.dump
```

Then, you need to import it to the Heroku database.

```
heroku pg:psql DATABASE_URL --app name_of_your_app < database.dump
```

At this stage, your Heroku application is entirely running with its own database.

{% hint style="success" %}
That's it! Your local database is now available as your **production database** on Heroku. 🎉
{% endhint %}

N.B: You can make sure by checking the Heroku logs using the command :

{% code title="" %}

```
heroku logs -t -a name_of_your_app
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.forestadmin.com/documentation/extra-help/databases/populate-a-postgresql-database-on-heroku.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
