How to create a wrapper for db
with tenant_id
to always be added to where clause?
#4633
Unanswered
bluepuma77
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi community,
I would like to use Drizzle for a multi-tenant DB running with regular NodeJS server.
Is it possible to automagically add a where clause to all query functions?
Bonus: also add an additional field to all insert and update functions?
Are there best practices to implement something like this in 2025? Chatbots going crazy, but delivered nothing useful.
Note 1: currently not looking into RLS, as the database might change to something different than Postgres.
Note 2: this has been discussed here a year ago, without a real solution (discussion), maybe something changed?
Note 3: potentially relevant discussion about middleware (discussion)
Beta Was this translation helpful? Give feedback.
All reactions