Rob Schilder
Explore posts from serversDTDrizzle Team
•Created by Rob Schilder on 10/22/2024 in #help
Is there a way to enforce that all queries include a where clause on "tenantId"?
My question is exactly the same as this user:
https://github.com/drizzle-team/drizzle-orm/discussions/1539
I'm writing a single-database, multi-tenant app and would like to make sure every query contains a filter on tenantId so I don't accidentally show data from one tenant to another. Doesn't need to do anything fancy like rewrite the query, just check if it's there and throw an exception if it isn't. Ideally would be able to check that the correct tenantId is specified so would be great if the check could be changed on a request per request basis. Have commented on another discussion about hooks which feel like they could be a good way to achieve this, but thought I'd ask it as a separate question in case there already is a way to do this?Anyone in Discord knows the current solution for this or know if the team is working on this?
3 replies