Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

providing the right sequelize.js object to connect to the database(multi-tenant application) #1

Open
anoopsinghbayes opened this issue Apr 3, 2014 · 1 comment

Comments

@anoopsinghbayes
Copy link

label Question

First some Background:

We are trying to create a multi-tenant application ,we thought of going on with using the mean stack first and create multiple collection for each tenant (eg order_tenant1,order_tenant2 etc) then we went through some blogs that suggested against this approach ,second we felt the need of transaction as a core requirement of our DB thus opened our self's to RDBMS lke mysql and mariaDB ,we stumbled upon a blog http://web.archive.org/web/20120211232457/http://www.reachcrm.com/2010/03/11/multi-tenant-strategy-for-saas-using-mysql5
which explained the approach in a lot of detail which says to create views to get ,update and insert data related to tenant and views parameter would be defined thorugh the connection string as we are using node.js i found ORM for mysql sequelizejs which is quite good .

the actual problem:

as per my experience of the mean stack we define the mongo connection in the server.js file and the application establishes those connection at the application start and keeps them alive , enter image description here how can i have multiple sequelizejs (or for that matter and database connection )objects to connect to the database according to the user belonging to a particular tenant and provide the right object to the application to carry on with the business logic

1)should i create a new connection object on every request the application get and then close it after the request is processed ?

2)or is there any better way to handle this in node ,express or sequelizejs!

@yogeshbonzer
Copy link

yogeshbonzer commented Feb 2, 2018

Is sequelize.js supports multi-tenant functionality?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants