Matomo database will be upgraded from version 4.7.1 to the new version 5.1.0.
The following dimensions will be updated: log_conversion.pageviews_before.
If you have a large Matomo database, updates might take too long to run in the browser. In this situation, you can execute the updates from your command line:
FYI: these are the SQL queries and console commands that will be executed to upgrade your database to Matomo 5.1.0
# These SQL queries will be executed:
ALTER TABLE `matomo_user` ADD COLUMN `invite_status` ENUM('accept','pending','decline','expired') DEFAULT 'accept';
ALTER TABLE `matomo_user` DROP COLUMN `invite_status`;
ALTER TABLE `matomo_user` ADD COLUMN `invite_token` VARCHAR(191) DEFAULT null;
ALTER TABLE `matomo_user` ADD COLUMN `invited_by` VARCHAR(100) DEFAULT null;
ALTER TABLE `matomo_user` ADD COLUMN `invite_expired_at` TIMESTAMP null DEFAULT null;
ALTER TABLE `matomo_user` ADD COLUMN `invite_accept_at` TIMESTAMP null DEFAULT null;
ALTER TABLE `matomo_site` ADD COLUMN `excluded_referrers` TEXT NOT NULL AFTER `excluded_user_agents`;
ALTER TABLE `matomo_user` ADD UNIQUE KEY uniq_email (`email`);
UPDATE matomo_user SET idchange_last_viewed = NULL;
ALTER TABLE `matomo_user` CHANGE `idchange_last_viewed` `idchange_last_viewed` INTEGER UNSIGNED;
ALTER TABLE `matomo_user` ADD COLUMN `invite_link_token` VARCHAR(191) DEFAULT null;
DELETE FROM `matomo_archive_numeric_2021_12` WHERE ts_archived is null;
ALTER TABLE `matomo_archive_numeric_2021_12` DROP INDEX `index_idsite_dates_period`;
ALTER TABLE `matomo_archive_numeric_2021_12` ADD INDEX index_idsite_dates_period (`idsite`, `date1`, `date2`, `period`, `name` (6));
DELETE FROM `matomo_archive_numeric_2022_01` WHERE ts_archived is null;
ALTER TABLE `matomo_archive_numeric_2022_01` DROP INDEX `index_idsite_dates_period`;
ALTER TABLE `matomo_archive_numeric_2022_01` ADD INDEX index_idsite_dates_period (`idsite`, `date1`, `date2`, `period`, `name` (6));
DELETE FROM `matomo_archive_numeric_2022_02` WHERE ts_archived is null;
ALTER TABLE `matomo_archive_numeric_2022_02` DROP INDEX `index_idsite_dates_period`;
ALTER TABLE `matomo_archive_numeric_2022_02` ADD INDEX index_idsite_dates_period (`idsite`, `date1`, `date2`, `period`, `name` (6));
DELETE FROM `matomo_archive_numeric_2022_03` WHERE ts_archived is null;
ALTER TABLE `matomo_archive_numeric_2022_03` DROP INDEX `index_idsite_dates_period`;
ALTER TABLE `matomo_archive_numeric_2022_03` ADD INDEX index_idsite_dates_period (`idsite`, `date1`, `date2`, `period`, `name` (6));
DELETE FROM `matomo_archive_numeric_2022_04` WHERE ts_archived is null;
ALTER TABLE `matomo_archive_numeric_2022_04` DROP INDEX `index_idsite_dates_period`;
ALTER TABLE `matomo_archive_numeric_2022_04` ADD INDEX index_idsite_dates_period (`idsite`, `date1`, `date2`, `period`, `name` (6));
DELETE FROM `matomo_archive_numeric_2022_05` WHERE ts_archived is null;
ALTER TABLE `matomo_archive_numeric_2022_05` DROP INDEX `index_idsite_dates_period`;
ALTER TABLE `matomo_archive_numeric_2022_05` ADD INDEX index_idsite_dates_period (`idsite`, `date1`, `date2`, `period`, `name` (6));
DELETE FROM `matomo_archive_numeric_2022_06` WHERE ts_archived is null;
ALTER TABLE `matomo_archive_numeric_2022_06` DROP INDEX `index_idsite_dates_period`;
ALTER TABLE `matomo_archive_numeric_2022_06` ADD INDEX index_idsite_dates_period (`idsite`, `date1`, `date2`, `period`, `name` (6));
DELETE FROM `matomo_archive_numeric_2022_07` WHERE ts_archived is null;
ALTER TABLE `matomo_archive_numeric_2022_07` DROP INDEX `index_idsite_dates_period`;
ALTER TABLE `matomo_archive_numeric_2022_07` ADD INDEX index_idsite_dates_period (`idsite`, `date1`, `date2`, `period`, `name` (6));
DELETE FROM `matomo_archive_numeric_2022_08` WHERE ts_archived is null;
ALTER TABLE `matomo_archive_numeric_2022_08` DROP INDEX `index_idsite_dates_period`;
ALTER TABLE `matomo_archive_numeric_2022_08` ADD INDEX index_idsite_dates_period (`idsite`, `date1`, `date2`, `period`, `name` (6));
DELETE FROM `matomo_archive_numeric_2022_09` WHERE ts_archived is null;
ALTER TABLE `matomo_archive_numeric_2022_09` DROP INDEX `index_idsite_dates_period`;
ALTER TABLE `matomo_archive_numeric_2022_09` ADD INDEX index_idsite_dates_period (`idsite`, `date1`, `date2`, `period`, `name` (6));
DELETE FROM `matomo_archive_numeric_2022_10` WHERE ts_archived is null;
ALTER TABLE `matomo_archive_numeric_2022_10` DROP INDEX `index_idsite_dates_period`;
ALTER TABLE `matomo_archive_numeric_2022_10` ADD INDEX index_idsite_dates_period (`idsite`, `date1`, `date2`, `period`, `name` (6));
DELETE FROM `matomo_archive_numeric_2022_11` WHERE ts_archived is null;
ALTER TABLE `matomo_archive_numeric_2022_11` DROP INDEX `index_idsite_dates_period`;
ALTER TABLE `matomo_archive_numeric_2022_11` ADD INDEX index_idsite_dates_period (`idsite`, `date1`, `date2`, `period`, `name` (6));
DELETE FROM `matomo_archive_numeric_2022_12` WHERE ts_archived is null;
ALTER TABLE `matomo_archive_numeric_2022_12` DROP INDEX `index_idsite_dates_period`;
ALTER TABLE `matomo_archive_numeric_2022_12` ADD INDEX index_idsite_dates_period (`idsite`, `date1`, `date2`, `period`, `name` (6));
DELETE FROM `matomo_archive_numeric_2023_01` WHERE ts_archived is null;
ALTER TABLE `matomo_archive_numeric_2023_01` DROP INDEX `index_idsite_dates_period`;
ALTER TABLE `matomo_archive_numeric_2023_01` ADD INDEX index_idsite_dates_period (`idsite`, `date1`, `date2`, `period`, `name` (6));
DELETE FROM `matomo_archive_numeric_2023_02` WHERE ts_archived is null;
ALTER TABLE `matomo_archive_numeric_2023_02` DROP INDEX `index_idsite_dates_period`;
ALTER TABLE `matomo_archive_numeric_2023_02` ADD INDEX index_idsite_dates_period (`idsite`, `date1`, `date2`, `period`, `name` (6));
DELETE FROM `matomo_archive_numeric_2023_03` WHERE ts_archived is null;
ALTER TABLE `matomo_archive_numeric_2023_03` DROP INDEX `index_idsite_dates_period`;
ALTER TABLE `matomo_archive_numeric_2023_03` ADD INDEX index_idsite_dates_period (`idsite`, `date1`, `date2`, `period`, `name` (6));
DELETE FROM `matomo_archive_numeric_2023_04` WHERE ts_archived is null;
ALTER TABLE `matomo_archive_numeric_2023_04` DROP INDEX `index_idsite_dates_period`;
ALTER TABLE `matomo_archive_numeric_2023_04` ADD INDEX index_idsite_dates_period (`idsite`, `date1`, `date2`, `period`, `name` (6));
DELETE FROM `matomo_archive_numeric_2023_05` WHERE ts_archived is null;
ALTER TABLE `matomo_archive_numeric_2023_05` DROP INDEX `index_idsite_dates_period`;
ALTER TABLE `matomo_archive_numeric_2023_05` ADD INDEX index_idsite_dates_period (`idsite`, `date1`, `date2`, `period`, `name` (6));
DELETE FROM `matomo_archive_numeric_2023_06` WHERE ts_archived is null;
ALTER TABLE `matomo_archive_numeric_2023_06` DROP INDEX `index_idsite_dates_period`;
ALTER TABLE `matomo_archive_numeric_2023_06` ADD INDEX index_idsite_dates_period (`idsite`, `date1`, `date2`, `period`, `name` (6));
DELETE FROM `matomo_archive_numeric_2023_07` WHERE ts_archived is null;
ALTER TABLE `matomo_archive_numeric_2023_07` DROP INDEX `index_idsite_dates_period`;
ALTER TABLE `matomo_archive_numeric_2023_07` ADD INDEX index_idsite_dates_period (`idsite`, `date1`, `date2`, `period`, `name` (6));
DELETE FROM `matomo_archive_numeric_2023_08` WHERE ts_archived is null;
ALTER TABLE `matomo_archive_numeric_2023_08` DROP INDEX `index_idsite_dates_period`;
ALTER TABLE `matomo_archive_numeric_2023_08` ADD INDEX index_idsite_dates_period (`idsite`, `date1`, `date2`, `period`, `name` (6));
DELETE FROM `matomo_archive_numeric_2023_09` WHERE ts_archived is null;
ALTER TABLE `matomo_archive_numeric_2023_09` DROP INDEX `index_idsite_dates_period`;
ALTER TABLE `matomo_archive_numeric_2023_09` ADD INDEX index_idsite_dates_period (`idsite`, `date1`, `date2`, `period`, `name` (6));
DELETE FROM `matomo_archive_numeric_2023_10` WHERE ts_archived is null;
ALTER TABLE `matomo_archive_numeric_2023_10` DROP INDEX `index_idsite_dates_period`;
ALTER TABLE `matomo_archive_numeric_2023_10` ADD INDEX index_idsite_dates_period (`idsite`, `date1`, `date2`, `period`, `name` (6));
DELETE FROM `matomo_archive_numeric_2023_11` WHERE ts_archived is null;
ALTER TABLE `matomo_archive_numeric_2023_11` DROP INDEX `index_idsite_dates_period`;
ALTER TABLE `matomo_archive_numeric_2023_11` ADD INDEX index_idsite_dates_period (`idsite`, `date1`, `date2`, `period`, `name` (6));
DELETE FROM `matomo_archive_numeric_2023_12` WHERE ts_archived is null;
ALTER TABLE `matomo_archive_numeric_2023_12` DROP INDEX `index_idsite_dates_period`;
ALTER TABLE `matomo_archive_numeric_2023_12` ADD INDEX index_idsite_dates_period (`idsite`, `date1`, `date2`, `period`, `name` (6));
DELETE FROM `matomo_archive_numeric_2024_01` WHERE ts_archived is null;
ALTER TABLE `matomo_archive_numeric_2024_01` DROP INDEX `index_idsite_dates_period`;
ALTER TABLE `matomo_archive_numeric_2024_01` ADD INDEX index_idsite_dates_period (`idsite`, `date1`, `date2`, `period`, `name` (6));
DELETE FROM `matomo_archive_numeric_2024_02` WHERE ts_archived is null;
ALTER TABLE `matomo_archive_numeric_2024_02` DROP INDEX `index_idsite_dates_period`;
ALTER TABLE `matomo_archive_numeric_2024_02` ADD INDEX index_idsite_dates_period (`idsite`, `date1`, `date2`, `period`, `name` (6));
DELETE FROM `matomo_archive_numeric_2024_03` WHERE ts_archived is null;
ALTER TABLE `matomo_archive_numeric_2024_03` DROP INDEX `index_idsite_dates_period`;
ALTER TABLE `matomo_archive_numeric_2024_03` ADD INDEX index_idsite_dates_period (`idsite`, `date1`, `date2`, `period`, `name` (6));
DELETE FROM `matomo_archive_numeric_2024_04` WHERE ts_archived is null;
ALTER TABLE `matomo_archive_numeric_2024_04` DROP INDEX `index_idsite_dates_period`;
ALTER TABLE `matomo_archive_numeric_2024_04` ADD INDEX index_idsite_dates_period (`idsite`, `date1`, `date2`, `period`, `name` (6));
DELETE FROM `matomo_archive_numeric_2024_05` WHERE ts_archived is null;
ALTER TABLE `matomo_archive_numeric_2024_05` DROP INDEX `index_idsite_dates_period`;
ALTER TABLE `matomo_archive_numeric_2024_05` ADD INDEX index_idsite_dates_period (`idsite`, `date1`, `date2`, `period`, `name` (6));
DELETE FROM `matomo_archive_numeric_2024_06` WHERE ts_archived is null;
ALTER TABLE `matomo_archive_numeric_2024_06` DROP INDEX `index_idsite_dates_period`;
ALTER TABLE `matomo_archive_numeric_2024_06` ADD INDEX index_idsite_dates_period (`idsite`, `date1`, `date2`, `period`, `name` (6));
DELETE FROM `matomo_archive_numeric_2024_07` WHERE ts_archived is null;
ALTER TABLE `matomo_archive_numeric_2024_07` DROP INDEX `index_idsite_dates_period`;
ALTER TABLE `matomo_archive_numeric_2024_07` ADD INDEX index_idsite_dates_period (`idsite`, `date1`, `date2`, `period`, `name` (6));
ALTER TABLE `matomo_user_token_auth` ADD COLUMN `post_only` TINYINT(2) UNSIGNED NOT NULL DEFAULT '0';
ALTER TABLE `matomo_log_conversion` ADD COLUMN `pageviews_before` SMALLINT UNSIGNED DEFAULT NULL;
The database upgrade process may take a while, so please be patient.