• Elisabeth Nebster

[Product Update]: Schema Based Multi-tenancy

Multi-tenancy is how we in XME stay responsive to business needs and keep client satisfaction at the highest level. Each client receives personalized attention from the business - with the Schema Based Approach, which we now use to ensure data security and decrease manual work for the support team. Business, clients, and technical specialists will finally sleep tight at night: data is secured.

Multi-tenancy allows having multiple businesses on one hardware, which significantly decreases costs and is typical for SaaS solutions. However, we faced a data segregation issue. The client was concerned about data protection. We were trying to save resources and stay out of creating a separate tenant for every new user in the system.


There are several options to deal with this issue:

  1. Shared Schema for Tenants (Discriminant Column)

  2. Separate Schema for Each Tenant (Schema Based Approach)

  3. Single DataBase for Single Tenant



We chose the second one - Schema Based Approach. Separate Schema for Each Tenant means the app connects to a single database instance. Each Tenant has its own schema (a set of tables) within the database but not an entire database.


What about the Business Logic?

For example, one of your clients once said he'd like to receive SMS after the payment, and the other client asked to send him an e-mail. We created Tenant specific Logic Extention Points for such cases. It allowed adding a specific point during the program delivery and requesting if there was any specific script for this particular Tenant. If it's a "yes," run the script (send SMS, for example). Otherwise, the program runs on default.


Thus, we create configurational-specific folders called Tenant-Client-X. Scripts run only for the tenants they were added to. When creating each Entity, we say: when saving Entity for a Payment request - send SMS here for my Tenant (this particular client). There could be a different script for another Tenant - send him an e-mail, please, or do nothing if the script was configured so for the client.


With this configuration, we can satisfy all different requests from all the clients. The main idea of Multi-tenancy is to separate data between different clients and integrate data and logic into one application for the owning Tenant without influencing other tenants. This approach saves resources and speeds up running the program. Oh, and it provides Data Security, too.



Read more

Want to beat 53% your competitors?