-
Notifications
You must be signed in to change notification settings - Fork 122
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
How to use multiple databases (multitenancy) #147
Comments
I had such experience recently, the whole point is to make a custom adapter and process the variables, at some point I collect the variables, middleware forwards them further and replaces the adapter, or rather creates more connections and adds an adapter with an identifier that the before hook accesses it and already works with another database through the adapter, maybe this is not the most beautiful way, but I could not find another. |
Hello, I do not want to open a new issue, and I hope my problem is similar to this one. If not, I will open a new issue. The rule said:
Then you have the rule:
The first rule makes sense because it follows the Database per service pattern; the second I can also understand. The problem is that the first rule is not working. I tried to have DB per service, and in MongooseAdapter, I pass different DB URI, but Moleculer somehow always finds a wat to initiate one DB and put all documents into one DB.
Does anyone has this problem? Any idea what is wrong? |
Hey @dragan-lalos . You might check #132 (comment) I think this is want you want |
Hello , how can I use multiple databases for my project? For my current php application , I created a middleware where it gets subdomain and connects users to its database , so its subdomain based multitenant application. How can I achieve similar approach? Moleculerjs is is awesome , so I want to remake my application with moleculerjs. I use mysql, I believe I should use sequelize for my application. Thank you in advance for your help.
The text was updated successfully, but these errors were encountered: