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

Change charset in database schema to utf8mb4 #1013

Closed
wrigleyDan opened this issue May 7, 2024 · 0 comments · Fixed by #1017
Closed

Change charset in database schema to utf8mb4 #1013

wrigleyDan opened this issue May 7, 2024 · 0 comments · Fixed by #1017

Comments

@wrigleyDan
Copy link
Contributor

Is your feature request related to a problem? Please describe.
When creating a new Book it happened to me that a document title included an emoji which caused a database error:
Mysql2::Error: Incorrect string value: ...

The error is caused because the database column display_fields in the database table query_doc_pairs uses the deprecated (I think at least it's deprecated) charset utf8mb3.
Changing the charset in the database table resolved the issue for me:

ALTER TABLE query_doc_pairs MODIFY document_fields mediumtext CHARACTER SET utf8mb4;

Describe the solution you'd like
Change the charset for the database table query_doc_pairs from utf8mb3 to utf8mb4.

As of now this change would need to happen in here: https://github.com/o19s/quepid/blob/main/db/schema.rb#L183

The changed line should look like this:
create_table "query_doc_pairs", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t|

From my perspective it makes sense to look at the rest of the database tables and columns as well and see if this makes sense for more than just the one table.

Describe alternatives you've considered
No alternatives considered.

Additional context
No screenshots to share.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant