-
Notifications
You must be signed in to change notification settings - Fork 170
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
Append table name to Builder to prevent conflicting ID
s in SQL query
#139
base: master
Are you sure you want to change the base?
Conversation
Fixes the issue "Column 'id' in where clause is ambiguous" when using additional scopes.
Same issue here.. |
@mpociot Can this be merged in? I've been using the fork without issue in production for almost 1 year now :) |
@kyranb when the tests are green, we will consider merging it. |
@okaufmann Can you take a look? I'm not that familiar with mockery, but it looks like just the table name (users) needs to be added in somewhere as the query now includes that. |
@kyranb please merge the current master in your feature branch so the latest test actions can run again. |
@okaufmann Sorry for the delay here Oliver. I've just done so :) |
@okaufmann @mpociot Can this be reviewed or merged? |
@mpociot @okaufmann Bump :) |
Fixes the issue "Column 'id' in where clause is ambiguous" when using additional scopes.
Example query that fails due to not specifying the table name for
id
:SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'id' in where clause is ambiguous (SQL: select
users
.*,tenants_user
.team_id
aspivot_team_id
,tenants_user
.user_id
aspivot_user_id
,tenants_user
.created_at
aspivot_created_at
,tenants_user
.updated_at
aspivot_updated_at
fromusers
inner jointenants_user
onusers
.id
=tenants_user
.user_id
wheretenants_user
.team_id
= 2 andid
= 1 andusers
.deleted_at
is null limit 1)