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

Models with relationships across different databases #2349

Closed
jsagethuboo opened this issue Dec 20, 2022 · 1 comment
Closed

Models with relationships across different databases #2349

jsagethuboo opened this issue Dec 20, 2022 · 1 comment

Comments

@jsagethuboo
Copy link

jsagethuboo commented Dec 20, 2022

Hello, do you have an example with models that contain nested relationships between different databases?

For example if you had an Order model which hasMany Items which are on the same DB but then the Items have a manufacturer which is on another DB I know if they were non nested I would use two queries with different transaction knex connections:

        await order.$fetchGraph(
           '[items]',
          {transaction: this.ordersDB.getConnection()}
        )
      await order.$fetchGraph(
         '['items.manufacturer']',
         {transaction: this.manufacturerDB.getConnection()}
       )

But If like in my given example the relation is through a model which lives on the same DB but the relation on that model lives on another DB how would that be achieved?

Thanks for any support/guidance let me know if you need me to clarify anything

@lehni
Copy link
Collaborator

lehni commented Apr 15, 2023

Given the current state of the library and its lack of a core maintainer, as well as more general question as to wether this pattern is even a good idea in general (See https://stackoverflow.com/questions/8561412/relationships-between-tables-from-different-databases for example), I am going to close this as as a wontifx. I hope you understand.

@lehni lehni closed this as completed Apr 15, 2023
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