-
-
Notifications
You must be signed in to change notification settings - Fork 360
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
[WIP] Feat: move to cloud #765
base: main
Are you sure you want to change the base?
Conversation
… and questions tables
…estion, and questions tables
…atabase compatibility
… display order and performance
…proved performance
…for improved compatibility
…gs assertions in tests
$table->rawIndex('name collate nocase', 'name_collate_nocase'); | ||
}else{ | ||
// mysql | ||
$table->index('name', 'name_case_insensitive', 'BTREE'); // not working |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@steven-fox can you help here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MrPunyapal Hey man. Here's my understanding:
In mysql, collation is controlled on a per-column basis. Therefore, if the collation on the name
column of our hashtags
table is case insensitive (for example, a collation of utf8mb4_unicode_ci
[that _ci
is "case-insensitive" instead of _cs
for "case-sensitive"]), then you should only need to specify a standard index on the column and you'll be good to go. The custom index was needed for sqlite to force an index that isn't case sensitive.
Try doing a normal $table->index('name');
and then run the tests (or manually check) with a mysql db.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I already tried that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry - I had to re-read the error you sent me of the failing test again. Based on that, it looks like the ACTUAL problem is that a unique constraint violation is occurring when attempting to insert records of foo
and Foo
, which makes sense, as the column probably has a case insensitive collation so we'd need to manually specify a case sensitive unique index.
Here's what I'd do:
- Use a case insensitive column definition for
hashtags.name
(probably the default). Something likeutfmb4_0900_ai_ci
would be a good choice. Again, probably doesn't have to be specified manually as it's likely the default across the database, but would check for the production db to be sure. - Apply a normal index on the
name
column (so the index will be case insensitive) for our hashtag lookups. Mainly used in\App\Services\Autocomplete\Types\Hashtags
and\App\Queries\Feeds\RecentQuestionsFeed
. - Apply a case sensitive unique index on the
name
column. I don't think there are Blueprint helpers for this in Laravel. You may have to doDB::raw(CREATE UNIQUE INDEX hashtags_name_unique ON hashtags (name COLLATE utf8mb4_bin);
… migration for collation
No description provided.