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

Fix query for translatable slug #285

Merged
merged 1 commit into from
Dec 30, 2024
Merged

Conversation

andrii-trush
Copy link
Contributor

@andrii-trush andrii-trush commented Dec 18, 2024

It was an error with $additionalQuery for translatable slug

e.g. example it was before fix:

select * from `posts` where json_unquote(json_extract(`slug`, '$."nl"')) = '/' or json_unquote(json_extract(`slug`, '$."en"')) = '/' and `team_id` = 3

correct SQL should be

select * from `posts` where (json_unquote(json_extract(`slug`, '$."nl"')) = '/' or json_unquote(json_extract(`slug`, '$."en"')) = '/') and `team_id` = 3

it was WHERE statement1 or statement2 and additionalStatement3 instead of WHERE (statement1 or statement2) and additionalStatement3

@freekmurze

It was an error with `$additionalQuery` for translatable slug

e.g. example it was before fix:

```sql
select * from `posts` where json_unquote(json_extract(`slug`, '$."nl"')) = '/' or json_unquote(json_extract(`slug`, '$."en"')) = '/' and `team_id` = 3
```

it was `WHERE statement1 or statement2 and additionalStatement3` instead of `WHERE (statement1 or statement2) and additionalStatement3`
@andrii-trush
Copy link
Contributor Author

@freekmurze Is any chance to merge this PR?

@freekmurze freekmurze merged commit cfe8440 into spatie:main Dec 30, 2024
14 checks passed
@freekmurze
Copy link
Member

Thanks!

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.

2 participants