From 4d827c5eed24303f4c599d6f070a8081b02cf17f Mon Sep 17 00:00:00 2001 From: Mathijs van Veluw Date: Mon, 28 Feb 2022 15:11:48 +0100 Subject: [PATCH] Updated Using the PostgreSQL Backend (markdown) --- Using-the-PostgreSQL-Backend.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Using-the-PostgreSQL-Backend.md b/Using-the-PostgreSQL-Backend.md index cb3ffbf..cc3148a 100644 --- a/Using-the-PostgreSQL-Backend.md +++ b/Using-the-PostgreSQL-Backend.md @@ -6,7 +6,13 @@ To run the binary or container ensure the `DATABASE_URL` environment variable is ```ini DATABASE_URL=postgresql://[[user]:[password]@]host[:port][/database] ``` -An example docker run environment variable would be: ```-e 'DATABASE_URL=postgresql://postgresadmin:strongpassword@postgres:5432/vaultwarden'```. +An example docker run environment variable would be: ```-e 'DATABASE_URL=postgresql://user_name:user_password@db_host:5432/vaultwarden'```. + +If you want to use a custom schema/search-path you need to use the following connection string:
+Note the `%3D` which is an url-encoded `=` sign +```ini +DATABASE_URL=postgresql://user_name:user_password@db_host:5432/vaultwarden?application_name=vaultwarden&options=-c search_path%3Ddb_schema +``` If your password contains special characters, you will need to use percentage encoding. @@ -16,7 +22,7 @@ If your password contains special characters, you will need to use percentage en A complete list of codes can be found on [Wikipedia page for percent encoding](https://en.wikipedia.org/wiki/Percent-encoding#Percent-encoding_reserved_characters) -**Migrating from SQLite to PostgreSQL** +## Migrating from SQLite to PostgreSQL An easy way of migrating from SQLite to PostgreSQL or to MySQL exists, but please, note that you **are using this at your own risk and you are strongly advised to backup your installation and data!**. This is **unsupported** and has not been robustly tested.