Unverified Commit 8d1f7526 authored by Frederic Alix's avatar Frederic Alix Committed by GitHub

feat: add possibility to set PostgreSQL schema other than public (#4161)

parent 66bf9147
...@@ -43,6 +43,9 @@ db: ...@@ -43,6 +43,9 @@ db:
# pfx: path/to/cert.pfx # pfx: path/to/cert.pfx
# passphrase: xyz123 # passphrase: xyz123
# Optional - PostgreSQL only:
schema: public
# SQLite only: # SQLite only:
storage: path/to/database.sqlite storage: path/to/database.sqlite
......
...@@ -138,6 +138,10 @@ module.exports = { ...@@ -138,6 +138,10 @@ module.exports = {
switch (WIKI.config.db.type) { switch (WIKI.config.db.type) {
case 'postgres': case 'postgres':
await conn.query(`set application_name = 'Wiki.js'`) await conn.query(`set application_name = 'Wiki.js'`)
// -> Set schema if it's not public
if (WIKI.config.db.schema && WIKI.config.db.schema !== 'public') {
await conn.query(`set search_path TO ${WIKI.config.db.schema}, public;`)
}
done() done()
break break
case 'mysql': case 'mysql':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment