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

Allow sharing of model definitions among datasources #60

Open
Damienmarble opened this issue Feb 14, 2019 · 1 comment
Open

Allow sharing of model definitions among datasources #60

Damienmarble opened this issue Feb 14, 2019 · 1 comment

Comments

@Damienmarble
Copy link
Contributor

Is your feature request related to a problem? Please describe.
My organization is creating a multitenant application using Sails, with Sequelize as our ORM to connect to existing database(s). Our goal is for new tenants with separate datasources to be able to be added purely through configuration changes. However, currently each model can be associated with only a single Sequelize instance.

Describe the solution you'd like
A way to namespace Models so that model multiple instances which function identically but point to different datasources can be created.

Describe alternatives you've considered
We could create separate model definitions for each tenant and explicitly name which datasource to associate with, but this violates our configuration-only requirement and will caused an ever-increasing maintenance burden as the number of models, tenants and places where they are used grow. (x models times y tenants times z places where a model is used and which one to use must be determined)

@KSDaemon
Copy link
Owner

KSDaemon commented Jul 6, 2019

Hi @Damienmarble! Hmm... Interesting feature. I personally don't see use cases for this.
But if someone decides to implement it without breaking major API — I'll gladly merge his PR :)
I see that @ThisIsNoZaku is working on this.

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

No branches or pull requests

2 participants