You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A SHOW CREATE TABLE do show that tables are using utf8mb4 (returns a CREATE TABLE statement with DEFAULT CHARSET=utf8mb4) but any CREATE TABLE statement not explicitly specifying DEFAULT CHARSET will create a table with latin1 character set.
I think the console core:convert-to-utf8mb should also change the database default character set, something like:
ALTERDATABASE`matomo`
DEFAULT CHARACTER SET='utf8mb4'
DEFAULT COLLATE ='utf8mb4_unicode_ci'
The text was updated successfully, but these errors were encountered:
That is actually on purpose. Some people might use a shared database for
Matomo and other software. We can't simply assume that a default utf8mb4
charset would work for everything else as well. As we define the charset
when creating new tables, that shouldn't be a problem at all.
For databases created by Matomo in installation, the charset should be set
to utf8mb4 if available.
I get it. It's true that my change could cause problem with shared databases.
As we define the charset when creating new tables, that shouldn't be a problem at all.
One thing though. If I am not mistaken, plugins that creates tables with foreign keys to string-type SQL columns now have to first detect/check what is the charset of the core Matomo tables in order to adapt their SQL CREATE TABLE statement. Otherwise an errno: 150 "Foreign key constraint is incorrectly formed" SQL error can occur...
@C-Duv this might be true, but we are actually not using any foreign keys in Matomo or any of our plugins. If that is something that should be cared of by a plugin developer, might be worth mentioning it in the developer docs.
Feel free to create a issue or PR there if you think that would be useful: https://github.com/matomo-org/developer-documentation
After running
console core:convert-to-utf8mb
to convert the database to character setutf8mb4
it looks like the default character set is stilllatin
.A
SHOW CREATE TABLE
do show that tables are usingutf8mb4
(returns aCREATE TABLE
statement withDEFAULT CHARSET=utf8mb4
) but anyCREATE TABLE
statement not explicitly specifyingDEFAULT CHARSET
will create a table withlatin1
character set.I think the
console core:convert-to-utf8mb
should also change the database default character set, something like:The text was updated successfully, but these errors were encountered: