Multi-DB inconsistency in accessing tagging tables #338
Replies: 2 comments
-
I'm pasting the actual error when trying to search for the tags from a model that's located in a different DB from the Illuminate\Database\QueryException: SQLSTATE[42S02]: Base table or view not found: select *, CAST(MODEL.updated_at AS CHAR) as updated_at, Again to recap, the model (MODEL) is in DB_A, the So everything in the select statement is actually correct - the model, that the The only thing wrong is the part where it was trying to access the It doesn't make sense though since the "override" of the tags method (which was in the documentation) already explicitly uses the new model for the tag (which I explicitly set to use DB_B). I even modified it to explicitly use the new tag (LocalTag)
It's worth noting that searching for tags from a model in the same db (DB_B) works as intended, but I believe this is a genuine bug, because it's able to resolve separate model/tagging info when setting and retrieving - it only breaks when searching |
Beta Was this translation helpful? Give feedback.
-
Hi, thanks for reporting this. As I'm not using this package in a multi-db context, I'm not going to invest time in fixing this. Feel free to send a PR with tests that will fix this problem. |
Beta Was this translation helpful? Give feedback.
-
So I followed the documentation on how to create/define your own tag model (to be able to use it in a multi DB setup)
I'm able to set the tags and retrieve them (I'm even able to do it with the model and the tagging tables on different DBs)
However when I try to SEARCH for them using the
withAnyTags
(or pretty much any search-related) method, it doesn't seem to use the tables as implemented in the adjustment I made.To replicate:
I have 2 DBs: A and B. As I mentioned earlier, I've applied the adjustments and set the taggables and tags table to DB B
I was able to set and retrieve tags even from model/entities from DB A (which means it's correctly setting the tagging information on the right tables in B, even if we're tagging the model from A)
However, when I tried searching for tags (
withAny
, etc) for tags in that very same model in A I was able to set/sync/retrieve tags with, it threw an error because it was trying to access the tagging information from A as well, instead of BBeta Was this translation helpful? Give feedback.
All reactions