Hey @florianmartens 👋
1.) The ability to annotate all queries for a model e. g. findOne find with an additional condition. In this case, a query like find() would automatically become findOne({ where: { tenantID } }) - this would allow isolation on the logic layer that is more robust than adding a filter condition to every query
I would suggest creating the feature request for this here with the above use case.
2.) The ability to pool database connections, allowing me to manage connections to many databases as well as run migrations with them.
For this, there is an on-going issue here and someone from the community has also created a library for that which you can check out.
» npm install prisma-multi-tenant
One Database each table hat a id and tenant_id column.
For approximately 100 Tenants each tenant had about 2000 users.
I plan to Identify each tenant by header X-Tenant-Id: tenant1
I have found somethin about Durable provider in the NestJs docs: https://docs.nestjs.com/fundamentals/injection-scopes
But in there is a Hint that this strategy is not ideal for applications operating with a large number of tenants. What is a "large number of tenant" and what is the best alternative ?
Is there a best practice example for NestJs & Prisma Multi tenancy ?
For scaling I plan something like this, but is this a good idea ? Databse Server 1 with DB 1 and Tenant 1 - 10 with DB2 and Tenant 10-20 with DB 3 and Tenant 20-30
Databse Server 2 with DB 4 and Tenant 40-50 with DB 5 and Tenant 50-60 with DB 6 and Tenant 60-70
Databse Server 3 with DB 4 and Tenant 70-80 with DB 5 and Tenant 80-90 with DB 6 and Tenant 90-100