Skip to content

Commit

Permalink
feat: add possibility to set PostgreSQL schema other than public (#4161)
Browse files Browse the repository at this point in the history
  • Loading branch information
fredericalix authored Sep 25, 2021
1 parent 66bf914 commit 8d1f752
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config.sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ db:
# pfx: path/to/cert.pfx
# passphrase: xyz123

# Optional - PostgreSQL only:
schema: public

# SQLite only:
storage: path/to/database.sqlite

Expand Down
4 changes: 4 additions & 0 deletions server/core/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ module.exports = {
switch (WIKI.config.db.type) {
case 'postgres':
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()
break
case 'mysql':
Expand Down

0 comments on commit 8d1f752

Please sign in to comment.