docs: fixed details about postgres url format (#4263)

This commit is contained in:
Shahed Nasser
2023-06-08 10:10:41 +03:00
committed by GitHub
parent 947e6aac77
commit 51bff28962
2 changed files with 19 additions and 3 deletions

View File

@@ -44,7 +44,23 @@ module.exports = {
}
```
Where `database_type` is `postgres` and `DATABASE_URL` is the URL connection string to your PostgreSQL database. You can check out how to format it in [PostgreSQLs documentation](https://www.postgresql.org/docs/current/libpq-connect.html).
Where `database_type` is `postgres` and `DATABASE_URL` is the URL connection string to your PostgreSQL database. The connection URL should be of the following format:
```bash
postgres://[user][:password]@[host][:port]/[dbname]
```
Where:
- `[user]`: (required) your PostgreSQL username. If not specified, the system's username is used by default.
- `[:password]`: an optional password for the user. When provided, make sure to put `:` before the password.
- `[host]`: (required) your PostgreSQL host. When run locally, it should be `localhost`.
- `[:post]`: an optional port that the PostgreSQL server is listening on. By default, it's `5432`. When provided, make sure to put `:` before the port.
- `[dbname]`: (required) the name of the database.
For example, the connection URL can be `postgres://postgres@localhost/medusa-store`.
You can learn more about the connection URL format in [PostgreSQLs documentation](https://www.postgresql.org/docs/current/libpq-connect.html).
It's recommended to set the Database URL as an environment variable:
@@ -59,7 +75,7 @@ Where `<YOUR_DATABASE_URL>` is the URL of your PostgreSQL database.
By default, the `public` schema is used in PostgreSQL. You can change it to use a custom schema by passing the `search_path` option in the database URL. For example:
```bash
postgres://localhost/store?options=-c search_path=test
postgres://postgres@localhost/store?options=-c search_path=test
```
Where `test` is the name of the database schema that should be used instead of `public`.

View File

@@ -7,4 +7,4 @@ Error: connect ECONNREFUSED ::1:5432
This error occurs because the backend couldn't connect to the PostgreSQL database. The issue could be one of the following:
1. PostgreSQL server isn't running. Make sure it's always running while the Medusa backend is running.
2. The connection URL to your PostgreSQL database is incorrect. This could be because of incorrect credentials, port number, or connection URL format. The format should be `postgresql://[user[:password]@][host][:port][/dbname][?paramspec]`. Make sure that the connection URL format is correct, and the credentials passed in the URL are correct.
2. The connection URL to your PostgreSQL database is incorrect. This could be because of incorrect credentials, port number, or connection URL format. The format should be `postgres://[user][:password]@[host][:port]/[dbname]`. Make sure that the connection URL format is correct, and the credentials passed in the URL are correct. You can learn more about formatting the connection URL [here](../../development/backend/configurations.md#postgresql-configurations)