From what I’ve seen the most common ways to manage multitenant/multicompany implementations are:
Option A. Add a tenant_id column to every table
Option B. Manage a separate set of tables for each tenant.
Each of the alternatives has is pros and cons, for example:
Option A Pros: Static database model, easier to manage, adding new companies is simpler.
Option A Cons: Security management is more complicated since needs to be managed at record level, backups and restores may affect others, every query needs to take the tenant_id column into account
Option B Pros: Each customer has an independent data store , allows to load balance or move certain databases to other servers, update/restore without affecting other tenant’s data or performance, when a tenant leaves its database could be dumped
Option B Cons: Database model keeps growing which implies management complexities as well
I wouldn’t dare to say which one is the “right one” because the solution has to be designed to fit the needs. Now, Servoy makes it very easy to develop for option A, since, at the solution startup one could add the foundset filters for the current tenant. However, there is no support for those who go for Option B, currently, the workaround is to define all of the possible database servers from the start and then use switchserver to use the appropriate one. For example: if you expect to have 99 tenants, you need to define conn01, conn02, con003… conn99 and at startup point to the appropriate one (and also send the appropriate one when using the raw_sql function ). That, of course is hard to manage, let’s say you now decide to work with another RDBMS (which is one of the beauties of Servoy) you would need to go and change all of those connections.
This could easily be handled on the development side if other parameters for a database connection could be changed, such as the Schema, Username and Password. I do not expect this to be easy to manage in Servoy since due to its N-tier design, the connections are handled by the Servoy Application Server, and if a user is able to change a connection parameter what would happen to the rest? Well I could try talking about an in-memory pool of connections but I would just look dumb because I really don’t know anything about that, you Servoy guys are the experts . I’m just trying to portray a common situation to see if others relate to it and would really find this functionality useful.
Another thing this would allow to do is to manage a database user for each application user, now, I know Servoy does manage security and logging pretty well. However there are cases where business needs or external requirements prevail and the solution has to cope with that. Such a case would be one a Servoy solution is connecting to the same Database that other applications connect to and an insitutions has an external database auditing tool to get all the read and writes and don’t want a generic database user to be shown.
I hope I explained myself correctly and you didn’t fall asleep while reading this. I tried to properly paint the picture so that others could support the idea.
Regards,
JD