AnishLushte07 / multi-tenant-application

Multi tenant application using NodeJs, express and mysql
Apache License 2.0
7 stars 6 forks source link

Procedure to add tenant dynamically or run migration automatically #2

Open manjeshpv opened 5 years ago

manjeshpv commented 5 years ago

as the tenant db connection details written in .env file,

adding tenant dynamically requires restart

I can achieve graceful restart using https://gist.github.com/manjeshpv/60924207056773954f6a346db6cc5249

is there any possibilities to dynamically bootup sequelize models inside running memory

https://github.com/AnishLushte07/multi-tenant-application/blob/master/server/conn/sqldb/dynamicConnection.js#L76

https://github.com/AnishLushte07/multi-tenant-application/blob/2ce643aeb78b182050e09bc0b57cb43dcc772863/server/app.js#L17

so migrations will run on tenant create api, instead of connection details .env and manually running migrations https://github.com/AnishLushte07/multi-tenant-application/blob/2ce643aeb78b182050e09bc0b57cb43dcc772863/sample.env#L8