Errors when using multiple database connections
ericlucit opened this issue · comments
If you have a taggable table in another database, there are error messages that appear when deleting a model
Illuminate/Database/QueryException with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'YOUR_TABLE_IN_OTHER_DB_NAME.tags' doesn't exist (SQL: select `tags`.*, `taggables`.`taggable_id` as `pivot_taggable_id`, `taggables`.`tag_id` as `pivot_tag_id`, `taggables`.`taggable_type` as `pivot_taggable_type` from `tags` inner join `taggables` on `tags`.`id` = `taggables`.`tag_id` where `taggables`.`taggable_id` = 18268 and `taggables`.`taggable_type` = App/YOUR_MODEL_IN_OTHER_DB_NAME order by `order_column` asc)'
Under the Requirements section this should be updated to note that the database tables MUST RESIDE on the same database
I think it's common knowledge that trying to do join queries with tables on different databases won't work out of the box, so I don't think we should add that to the docs at the moment.
There is no information in the README about the fact that this package uses Joins - And one might not think that because Laravel itself extrapolates joins automatically across databases for you. This specific package makes no mention of the fact that it uses explicit joins and the error messages from the package are not helpful - They just spit out a "Base table or view not found" error message
It also doesn't mention that it cascades deletes on soft deletes - Meaning when a developer soft-deletes a model, this package will hard delete the tags... This is destructive and cannot be reversed.
I only ask that you explicitly state in the README that