Multi-tenant architecture with Sequelize and MySQL

142
January 22, 2021, at 09:40 AM

I am building a multi-tenant SaaS app with MySQL(5.7 & 8) as a backend (because I know it and its easy client WorkBench). For data isolation I decided to have a dedicated schema per user. In order to achieve this I had to develop a "sequelize-like" module which is getting bigger after each release.

It works great, but maintenance is getting painfull... (upgrade of tables, and views and constraints... for almost every release is time consuming and open to errors (even with scripts))

Then I thought this could be a great opportunity to introduce Sequelize. With its great features, it should be a piece of cake. But obviously it is not. It doesn't cover my use case. Obviously the "MySQL schema" is part of the connection and can't be change dynamically, unless you initialize your model on every user request (don't even think about it!)... The 'schema' option in sequelize.define prefixes the table name, generating 'schema.table_name' instead of 'schema'.'table_name' which would make the job perfectly.

According to several posts, the only option is to move to PostGreSQL. Really ?

Does anyone has a working experience with Sequelize + multi schemas in MySQL (each schema having the same tables/structure/relations) Thanks for sharing !

READ ALSO
Setting nativeElement.scrollTop is not working in android app in angular

Setting nativeElement.scrollTop is not working in android app in angular

My code is working fine in browser but it has no effect in android appIs there anything missing for android app to work? Can anybody please help? Thankyou in advance

113
How to pass token to verify user across html pages using node js

How to pass token to verify user across html pages using node js

I am trying to pass a token that verifies which user is logged in across html pagesOnce the user logs in a token is created which contains the user _Id

77
How to add css animation keyframe to jointjs element

How to add css animation keyframe to jointjs element

I am creating jointjs custom element type using basicextend() method like below

119
Change WooCommerce phone number link on emails

Change WooCommerce phone number link on emails

I need WooCommerce email phone number to open Whatsapp on clickCurrently when I click on it, it opens option to dial the number, I want to change this to open to Whatsapp

124