Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to customize database schema name? #1632

Open
zxpectre opened this issue Feb 23, 2024 · 3 comments
Open

How to customize database schema name? #1632

zxpectre opened this issue Feb 23, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@zxpectre
Copy link

Is there a way to make db-sync use another schema instead of 'public'?

Say like passing a POSTGRES_SCHEMA env var with a different name?

This is really needed to properly take control over the setup and to manage better security permissions and versions.

@zxpectre zxpectre added the bug Something isn't working label Feb 23, 2024
@sgillespie
Copy link
Contributor

The schema looks to be hardcoded. I would support making this configurable

@zxpectre
Copy link
Author

Thanks @sgillespie, we really need this. Also I'm about to suggest CF's Ledger Sync to take same approach earlier.

Yes it is harcoded all across the repo, on code, migration files and tests.

Example:

rawExecute "create schema public" []

@kderme
Copy link
Contributor

kderme commented Feb 24, 2024

db-sync currently uses the default schema of the db. One solution is to change it before starting db-sync

alter database <db> set search_path to <schema>;

then db-sync will use the correct one.

Btw the "public" reference in the link that you sent is only used for testing and shouldn't be a problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants