Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Support sharded multi-tenant database model #31

Open
fabiofdsantos opened this issue Apr 7, 2020 · 5 comments
Open

Support sharded multi-tenant database model #31

fabiofdsantos opened this issue Apr 7, 2020 · 5 comments

Comments

@fabiofdsantos
Copy link
Contributor

First of all, thanks for this amazing work!

Since this project is using "database per tenant" as tenancy model, are you considering to support the shared multi-tenant model in the future?

More details:
https://github.com/microsoft/WingtipTicketsSaaS-MultiTenantDB#sharded-multi-tenant-saas-pattern

@Errorname
Copy link
Owner

Hi, thank you for the compliment 🙂

The initial purpose of this project is to be a wrapper of Prisma to handle the multi-tenant design pattern. I like the fact that prisma-multi-tenant does not touch your schema, nor your databases, but only act as a "router" to find your data based on the tenant. You could even "eject" of prisma-multi-tenant simply by uninstalling the package.

For what I understand, supporting the sharded multi-tenant pattern would require to have complete control over the schema of the project using prisma-multi-tenant, and making important changes in the schema. This would greatly increase the complexity of the package.

I'm not against such evolution, however, I'll probably not do it in the near future, as that would require a lot of work.

However, if you have an idea on how I could implement this pattern in a way that would:

  • not increase the overall complexity too much, and
  • not be invasive to the projects using prisma-multi-tenant,
    I'd love to hear about it! 🙂

@fabiofdsantos
Copy link
Contributor Author

I agree with you that It will lead to more complexity and currently I'm not looking for that solution but maybe a "nice to have" in the future since the pattern has some advantages.

However database-per-tenant model will be the best approach for most applications. Anyway, it's preferable to wait for a stable Prisma 2 and then think about it. In the mean time, we can leave this issue open..

@Errorname
Copy link
Owner

Errorname commented Jul 20, 2020

Hey @fabiofdsantos, good news! 🥳

Prisma now has a Middleware feature, that would allow for the sharded multi-tenancy model to be feasible!

However, I'll first need to implement the "one DB for all tenants" model (see issue). Then, I'll be able to make a mix of those two and support the Sharded model 🙂

@fabiofdsantos
Copy link
Contributor Author

Great news! I no longer use Prisma but I expect to come back in a few months

@xpluscal
Copy link

xpluscal commented Jan 17, 2023

Hey @Errorname is there any progress on this model?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants