Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Giehl <stefan@matomo.org>2022-09-14 11:34:42 +0300
committerGitHub <noreply@github.com>2022-09-14 11:34:42 +0300
commit76af61d3029609459f2d8a0261f4adbb2f1cbdec (patch)
tree68ece5b5e1bfa157e3a870fc231ae488c725a901
parenta8283ffb416107d0f41516a31b9536292c2d1612 (diff)
Fix column type for id change column (#19730)
-rw-r--r--core/Db/Schema/Mysql.php2
-rw-r--r--core/Updates/4.12.0-b3.php62
-rw-r--r--core/Version.php2
3 files changed, 64 insertions, 2 deletions
diff --git a/core/Db/Schema/Mysql.php b/core/Db/Schema/Mysql.php
index 9ac76c951d..7da9b0fab0 100644
--- a/core/Db/Schema/Mysql.php
+++ b/core/Db/Schema/Mysql.php
@@ -52,7 +52,7 @@ class Mysql implements SchemaInterface
superuser_access TINYINT(2) unsigned NOT NULL DEFAULT '0',
date_registered TIMESTAMP NULL,
ts_password_modified TIMESTAMP NULL,
- idchange_last_viewed TIMESTAMP NULL,
+ idchange_last_viewed INTEGER UNSIGNED NULL,
invited_by VARCHAR(100) NULL,
invite_token VARCHAR(191) NULL,
invite_expired_at TIMESTAMP NULL,
diff --git a/core/Updates/4.12.0-b3.php b/core/Updates/4.12.0-b3.php
new file mode 100644
index 0000000000..586d3b9e2b
--- /dev/null
+++ b/core/Updates/4.12.0-b3.php
@@ -0,0 +1,62 @@
+<?php
+
+/**
+ * Matomo - free/libre analytics platform
+ *
+ * @link https://matomo.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ *
+ */
+
+namespace Piwik\Updates;
+
+use Piwik\Common;
+use Piwik\Db;
+use Piwik\Updater;
+use Piwik\Updates as PiwikUpdates;
+use Piwik\Updater\Migration;
+use Piwik\Updater\Migration\Factory as MigrationFactory;
+
+/**
+ * Update for version 4.12.0-b3
+ */
+class Updates_4_12_0_b3 extends PiwikUpdates
+{
+ /**
+ * @var MigrationFactory
+ */
+ private $migration;
+
+ public function __construct(MigrationFactory $factory)
+ {
+ $this->migration = $factory;
+ }
+
+ /**
+ * @param Updater $updater
+ *
+ * @return Migration[]
+ */
+ public function getMigrations(Updater $updater)
+ {
+ $column = Db::fetchRow('SHOW COLUMNS FROM ' . Common::prefixTable('user') . ' LIKE \'idchange_last_viewed\'');
+
+ if (
+ empty($column)
+ || strpos(strtolower($column['Type']), 'int') !== false
+ || strpos(strtolower($column['Type']), 'unsigned') !== false
+ ) {
+ return [];
+ }
+
+ $removeValues = $this->migration->db->sql('UPDATE ' . Common::prefixTable('user') . ' SET idchange_last_viewed = NULL');
+ $columnUpdate = $this->migration->db->changeColumnType('user', 'idchange_last_viewed', 'INTEGER UNSIGNED');
+
+ return [$removeValues, $columnUpdate];
+ }
+
+ public function doUpdate(Updater $updater)
+ {
+ $updater->executeMigrations(__FILE__, $this->getMigrations($updater));
+ }
+}
diff --git a/core/Version.php b/core/Version.php
index 1c774e811c..ec30d71482 100644
--- a/core/Version.php
+++ b/core/Version.php
@@ -21,7 +21,7 @@ final class Version
* The current Matomo version.
* @var string
*/
- const VERSION = '4.12.0-b2';
+ const VERSION = '4.12.0-b3';
const MAJOR_VERSION = 4;