wiki icon indicating copy to clipboard operation
wiki copied to clipboard

Fix postgres db custom schema option not working

Open bergerkiller opened this issue 2 years ago • 1 comments

We encountered an issue when trying to configure a postgres DB schema, which was needed for integration with supabase. This was caused by knex migration scripts not having this same schema configured, and this custom schema not being created at startup.

This PR fixes both issues and allows for a successful startup and initialization of the wiki server.

I did notice that this option, while it exists in the code, isn't documented in the docs. It is set by using a config.yml with db.schema set, and I don't think it has an env parsing default. This might be something worth improving in the future.

bergerkiller avatar Sep 07 '23 13:09 bergerkiller

Added a change to only create the custom schema if it doesn't already exist. CREATE IF NOT EXISTS does not work by itself because the user requires CREATE permission on the database for it to work. When granting limited priviliges to the wiki database user this is undesirable.

bergerkiller avatar Oct 19 '23 11:10 bergerkiller