spacebarchat / server

Spacebar server - A reimplementation of the Discord.com backend, built with Typescript and love
https://spacebar.chat
GNU Affero General Public License v3.0
1.49k stars 250 forks source link

Use UTF8 for MySQL/MariaDB charset/collation #1154

Closed DEVTomatoCake closed 3 months ago

DEVTomatoCake commented 4 months ago

Currently, the tables created when using a MySQL or MariaDB database use latin1_swedish_ci as collation. This is the default value apparently if not otherwise specified.

It however prevents the usage of unicode emojis in messages, components, polls, reactions and many other places, which is why the charset should be changed to UTF8 and the collation to utf8mb4_general_ci. Postgres apparently uses UTF8 by default, so it'd have to be tested whether a change could cause issues there.

Typeorm supports a per-column charset/collation, however as every column has to be changed, this doesn't make much sense to use imo:

charset: string - Defines a column character set. Not supported by all database types. collation: string - Defines a column collation.