Page MenuHomePhabricator

Upgrade Matomo schema to utf8mb4
Closed, ResolvedPublic

Description

The Matomo instance at https://matomo.wikimedia.it/ was affected by this bug:

https://github.com/matomo-org/matomo/issues/16980

The fix was to upgrade the database schema to utf8mb4.

For historical reasons, here the intervention:

$ su www-data -s /bin/bash --commmand /var/www/matomo/www/console core:convert-to-utf8mb4 
This command will convert all Matomo database tables to utf8mb4.

Tracking will be disabled during this process.

If you want to see what this command is going to do use the --show option.
Execute updates? (y/N)
$ y

Disabling Matomo Tracking

Starting the database upgrade process now. This may take a while, so please be patient.

Executing ALTER TABLE `matomo_user` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_user_token_auth` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_twofactor_recovery_code` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_access` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_site` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_plugin_setting` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_site_setting` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_site_url` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_goal` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_logger_message` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_log_action` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_log_visit` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_log_conversion_item` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_log_conversion` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_log_link_visit_action` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_log_profiling` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_option` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_session` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_archive_invalidations` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_sequence` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_brute_force_log` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_tracking_failure` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_locks` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_user_language` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_user_dashboard` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_report` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_report_subscriptions` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_privacy_logdata_anonymizations` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_segment` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_custom_dimensions` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_archive_numeric_2020_01` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_archive_numeric_2020_12` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_archive_numeric_2021_01` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_archive_numeric_2021_02` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_archive_numeric_2021_03` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_archive_numeric_2021_04` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_archive_numeric_2021_05` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_archive_blob_2020_01` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_archive_blob_2020_12` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_archive_blob_2021_01` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_archive_blob_2021_02` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_archive_blob_2021_03` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_archive_blob_2021_04` CONVERT TO CHARACTER SET utf8mb4;...  done.
Executing ALTER TABLE `matomo_archive_blob_2021_05` CONVERT TO CHARACTER SET utf8mb4;...  done.
Updating used database charset in config.ini.php.

Enabling Matomo Tracking

Conversion to utf8mb4 successful.

Event Timeline

valerio.bozzolan triaged this task as Low priority.
valerio.bozzolan created this task.
valerio.bozzolan moved this task from Backlog to Recent changes on the WMIT-Infrastructure board.