1

I am writing a multi tenant application in which each tenant has their own schema in a database or their own database. Because the tenant data is separate I'd like to be able to customize their tables by adding columns, or by creating additional views to meet their specific needs. Ideally, I'd like to make changes without recompiling the code.

This desire seems to run counter to how MVC is intended to work. My question is, can MVC and a multi schema, multi tenant architecture work when the schemas differ from each other slightly? If so, how do I design models that will allow for those variations?

Sparafusile
  • 4,696
  • 7
  • 34
  • 57

2 Answers2

1

I wanted to throw this out there in case you haven't stumbled upon it yourself:

http://weblogs.asp.net/zowens/archive/2010/05/29/multi-tenant-asp-net-foundation.aspx

Ecnalyr
  • 5,792
  • 5
  • 43
  • 89
  • Thanks, this was a good read, but did not cover how to handle when the tables in each of the tenant's schemas differ. – Sparafusile Jul 23 '12 at 15:43
  • 1
    @Sparafusile have you seen this: http://stackoverflow.com/a/3270228/1026898 ? I've never done what you are asking for a solution to and I'm just trying to lessen your suffering a bit. If you have already read that, I apologize for getting your hopes up with the little Stackoverflow notification. – Ecnalyr Jul 24 '12 at 10:51
  • I think that's close to what I'm looking for. I had seen the links before, but I guess they didn't sink in. I'll go over them again and see if it will work for what I want. – Sparafusile Jul 24 '12 at 11:58
  • I'm learning a bit more about it - if I come across anything I'll update. For now it just seems that it is such an uncommon need that there is not a super clean way to do it. I see the possibility for the necessity of a tool / NuGet package to be built to accommodate people in a similar position. – Ecnalyr Jul 24 '12 at 11:59
0

Here at Citus we're building a distributed/sharded multi-tenant database using PostgreSQL. You can go over our use-case guide, which goes over an example application. We don't shard by schema, but instead shard by the tenant-id. The table is then sharded across multiple nodes. For per-tenant information, we use JSONB, which then allows different tenants to keep different tenant-specific information.

Sumedh
  • 131
  • 4