You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fetching resources from a different database results in the given query:
SELECT database.table.id AS database.table_id (...)
The dot (.) in the alias is illegal. This results in the following error:
Internal Server Error: Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.table_id ' at line 1:
The text was updated successfully, but these errors were encountered:
@Albertjan90 Could you test out the #1318 PR and add comments there? I don't have the test framework setup to handle multi tenancy, and unfortunately I'm a bit short on time at the moment to work on that.
This PR converts the '.' to '_' in the table_name to handle the same table name in both databases. Not sure if that's likely to happen, but without it I think we could have issues. Hopefully that doesn't create too long of aliases.
This issue is a (choose one):
Checklist before submitting:
Description
After upgrading JSONAPI::Resources to version 0.10.2 (coming from 0.9), we noticed the API is causing SQL errors when loading resources from a different database. We have a multi-tenant database, so some resources are fetched from a shared database. It seems this line is causing the syntax to break:
https://github.com/cerebris/jsonapi-resources/blob/master/lib/jsonapi/active_relation_resource.rb#L117
Fetching resources from a different database results in the given query:
The dot (.) in the alias is illegal. This results in the following error:
The text was updated successfully, but these errors were encountered: