Schema-based multi-tenancy #1287
-
|
Hi, I’d like to implement schema-based multi-tenancy in Postgres with Bun—keeping one database instance and switching schemas per tenant (e.g., via SET search_path). Is there a recommended way to achieve this with Bun? If so, could you point me to the suggested pattern or hooks? |
Beta Was this translation helpful? Give feedback.
Answered by
hhuseyinpay
Jan 28, 2026
Replies: 1 comment
-
|
Solved it with pgxpool: you can set the tenant schema in PrepareConn by running SET search_path there. Reference implementation link. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
hhuseyinpay
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Solved it with pgxpool: you can set the tenant schema in PrepareConn by running SET search_path there. Reference implementation link.