Broper
Broper

Reputation: 2208

Missing database connection when trying to set up Adonis with Postgres

After configuring my .env file to use Postgres, I get the following error:

RuntimeException: E_MISSING_DB_CONNECTION: Missing database connection {postgres}. Make sure you define it inside config/database.js 
file

Here is my .env file:

...
DB_CONNECTION=postgres
DB_HOST=127.0.0.1
DB_PORT=5432
DB_USER=postgres
...

Upvotes: 0

Views: 1008

Answers (1)

Broper
Broper

Reputation: 2208

Figured it out, even though I found in some Adonis documentation that the database connection should be postgres, I set the following in the .env file

DB_CONNECTION=pg

You also have to install the pg module if you don't have it

npm i --save pg

I think maybe the module changed names at some point?

Upvotes: 2

Related Questions