From 107cd4de4ca3c8cf30dcb576b911eac65da692a8 Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Tue, 17 Jan 2023 10:38:13 +0200 Subject: [PATCH] docs: fixed note about custom database schema (#3049) --- docs/content/usage/configurations.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/content/usage/configurations.md b/docs/content/usage/configurations.md index 55f0e1de10..884a71a16c 100644 --- a/docs/content/usage/configurations.md +++ b/docs/content/usage/configurations.md @@ -72,15 +72,12 @@ module.exports = { // ...other configurations database_type: "postgres", database_url: DATABASE_URL, - database_schema: process.env.DATABASE_SCHEMA, // optional }, } ``` 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 [PostgreSQL’s documentation](https://www.postgresql.org/docs/current/libpq-connect.html). -You can optionally set the `database_schema` option. By default, its value is `public`. When you set the `database_schema` option, you must add the `search_path` option to the database URL. For example, the value of `database_url` is `postgres://localhost/store?options=-c search_path=test` if `database_schema` is `test`. - It's recommended to set the Database URL as an environment variable: ```bash @@ -89,6 +86,16 @@ DATABASE_URL= Where `` is the URL of your PostgreSQL database. +### Changing PostgreSQL Schema + +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 +``` + +Where `test` is the name of the database schema that should be used instead of `public`. + ### Changing Database Type Remember to run migrations after you change your database type to `postgres` from another type: