lundi 10 mai 2021

How to handle a multi tenant with database per tenant application where each database has a different schema

I have a situation where I'm currently building a multitenant application where each tenant has it's own database. The problem that I'm struggling with is that each database could have a vastly different structure. There are approximately 150 different tenants with each database being different. Is there a method of being able to cleanly manage this?

I'm aware of how to handle a single application with multiple databases but I'm lost on how I can implement this over several different schemas without the code base becoming unmaintainable. An initial idea would be separating the data layer so each tenant has it's own repositories and entities as an individual micro service. This isn't really scalable long term but would provide the separation of keeping the core logic separated from the individual databases but feels a bit hacky. Are there any patterns, advice or examples where I could be pointed to so I can read further on this? Or is the method going forward just completely unfeasible?

I'm not asking anybody to write code for me or to provide a solution. I would just like a bit of advice for someone who may have worked with this kind of situation and potentially recommend steps forward.

Aucun commentaire:

Enregistrer un commentaire