json binary and collation #349
Unanswered
carlituxman
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
When use json field on mysql hasn't collation because is binary, but in mariadb json migrate create a longText field with collation.
We have a utf8mb4_unicode_ci (case insensitive)
Then doing a where like %$search% with $search = 'sesión', $search = 'sesion', $search = 'Sesión' should return same results, with mariadb works, but mysql not. We needed extends Illuminate\Database\Eloquent\Builder with this:
`public function whereCollateJsonLike($column, $value = null, $or = false)
{
$operator = 'like';
$searchOperator = $or ? 'orWhereRaw' : 'whereRaw';
To specify collation on search. too much tangled
I share with you because it's been a headache
Beta Was this translation helpful? Give feedback.
All reactions