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

Add _table_name_for_alias to replace '.' with '_' when creating an … #1318

Closed
wants to merge 1 commit into from

Conversation

lgebhardt
Copy link
Member

…alias to tables in another database

Fixes #1310, #1316

Ideally we'd have tests for this, but setting up the testing framework to handle external databases is not something I have time for at the moment.

All Submissions:

  • I've checked to ensure there aren't other open Pull Requests for the same update/change.
  • I've submitted a ticket for my issue if one did not already exist.
  • My submission passes all tests. (Please run the full test suite locally to cut down on noise from travis failures.)
  • I've used Github auto-closing keywords in the commit message or the description.
  • I've added/updated tests for this change.

New Feature Submissions:

  • I've submitted an issue that describes this feature, and received the go ahead from the maintainers.
  • My submission includes new tests.
  • My submission maintains compliance with JSON:API.

Bug fixes and Changes to Core Features:

  • I've included an explanation of what the changes do and why I'd like you to include them.
  • I've provided test(s) that fails without the change.

Test Plan:

Reviewer Checklist:

  • Maintains compliance with JSON:API
  • Adequate test coverage exists to prevent regressions

Copy link

@cedm cedm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lgebhardt Hi Larry, your PR works perfectly for me. All my API tests are passing just fine, whether the model is shared among all tenants or specific to each.

EDIT: I have to retract that statement: I tested with my monkey patch still in place. My bad. Your PR fixed the AS statement, but doesn't help with the WHERE clause issue. Here's the failing query with your PR:

SELECT public_accounts.id AS public_accounts_id FROM "public"."accounts" WHERE "public_accounts"."id" = $1

"public_accounts"."id" = $1 should be "public"."accounts"."id" = $1

(FYI, the above query is for a singleton resource)

@cedm
Copy link

cedm commented Mar 16, 2020

Just created a test setup to help replicate the issue. Repo at https://github.com/cedm/jsonapi-apartment-test

Check the README for details.

@lgebhardt
Copy link
Member Author

In testing the above repo, https://github.com/cedm/jsonapi-apartment-test, this pr does not fix the issue I thought we were having. Closing and will leave the issues open so we can fix with another pr.

@lgebhardt lgebhardt closed this Jan 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multi-tenancy SQL syntax error caused by ActiveRelationResource (0.10.x)
2 participants