-
Notifications
You must be signed in to change notification settings - Fork 11.3k
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
[5.4] Cross-connection has not working #17624
Comments
A (cleaned up) error message:
|
This was already reported here: #4649 |
The report you reference seems to be about 2 different servers, my report is about 1 server 2 schema's which is a different situation (since cross schema (ie. on the same server) JOINs/SUBSELECTs are possible, JOINs/SUBSELECT(s) on a different server not)... |
Hello, I have the same problem at the moment. I can get for example cars with motors (i use the with function and can also say wich motors i want) without any problems accross two databases on the same server. But if i want for example only cars with motors where the motor has a specific power (the whereHas function) it is not working. The real code is about adminlogs and the user -> player. I want to search for logs where the player->name is like something. (adminlog and user are in one database and player is in another, but on the same server). You can see the code on the attached screenshot. A workaround is that i can do it only with the with function and filter through the collection and remove the null relations. But that is not a solution because i call later other where and orderBy functions + paginate and this collection can be very big in the end. sorry for my english. |
Does this issue continue existing or was it fixed? Regards |
I didn't tested it until now and that project with the problem is not running anymore. Maybe someone else could try it out (with a very basic example). Regards |
I added package to manage this issue: https://github.com/hoyvoy/laravel-cross-database-subqueries |
Description:
I have a similar setup as mentioned in #17515 (two schema's on a single server and a couple of relationships between those). I explicitly specified both connections but as soon as I try a has (and probably whereHas too) query from the model on the first connection to a model on the second connection it fails stating that the second model's table can not be found (using the first connections schema), which is correct but wrong, since the relationship should know to look (since it is explicitly specified) in the second connections schema (probably a simple (pseudocode)
would suffice to fix the issue (assuming both schema's are on the same database server (otherwise it would never work, since it is near impossible to do subqueries across different server connections))
Steps To Reproduce:
Expected results
Since both models have their connections explicitly specified I'd expect to see it reflected in the resulting (sub)select (ie
) with schema1 optional since the query runs on this connection
The text was updated successfully, but these errors were encountered: