forked from matomo-org/matomo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix matomo-org#11596: Compatibility of Piwik with MySQL Group Replica…
…tion and MySQL InnoDB Cluster (matomo-org#11885) * Columns added to support mysql group replication (every table must have a primary key) * changed integer to bigint as "there are issues at other places where INTEGER is simply too small." * Update script created for 3.1.0 to Fix matomo-org#11596 * corrected php syntax and made the columns primary keys on add * updated the db upgrade to reflect the inclusion in version 3.2 instead of 3.1 * changed tabs to spaces * replaced tabs with spaces * Use consistent column names * Use consistent column names * Will be in 3.2.1 * Change Update version + bump version. * Version bump fail.
- Loading branch information
1 parent
9ae202d
commit 6cc320a
Showing
3 changed files
with
107 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<?php | ||
/** | ||
* Piwik - free/libre analytics platform | ||
* | ||
* @link http://piwik.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\Updater\Migration; | ||
use Piwik\Updater\Migration\Factory as MigrationFactory; | ||
use Piwik\Updates; | ||
|
||
/** | ||
* Update for version 3.6.0-b1. | ||
*/ | ||
class Updates_3_6_0_b1 extends Updates | ||
{ | ||
/** | ||
* @var MigrationFactory | ||
*/ | ||
private $migration; | ||
|
||
private $pluginSettingsTable = 'plugin_setting'; | ||
private $siteSettingsTable = 'site_setting'; | ||
private $logProfilingTable = 'log_profiling'; | ||
|
||
public function __construct(MigrationFactory $factory) | ||
{ | ||
$this->migration = $factory; | ||
} | ||
|
||
/** | ||
* Here you can define one or multiple SQL statements that should be executed during the update. | ||
* @param Updater $updater | ||
* @return Migration[] | ||
*/ | ||
public function getMigrations(Updater $updater) | ||
{ | ||
$migrations = []; | ||
$migrations = $this->getPluginSettingsMigrations($migrations); | ||
$migrations = $this->getSiteSettingsMigrations($migrations); | ||
$migrations = $this->getLogProfilingMigrations($migrations); | ||
|
||
return $migrations; | ||
} | ||
|
||
public function doUpdate(Updater $updater) | ||
{ | ||
$updater->executeMigrations(__FILE__, $this->getMigrations($updater)); | ||
} | ||
|
||
/** | ||
* @param Migration[] $queries | ||
* @return Migration[] | ||
*/ | ||
private function getPluginSettingsMigrations($queries) | ||
{ | ||
$queries[] = $this->migration->db->addColumn($this->pluginSettingsTable, 'idplugin_setting', 'BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT'); | ||
|
||
return $queries; | ||
} | ||
|
||
/** | ||
* @param Migration[] $queries | ||
* @return Migration[] | ||
*/ | ||
private function getSiteSettingsMigrations($queries) | ||
{ | ||
$queries[] = $this->migration->db->addColumn($this->siteSettingsTable, 'idsite_setting', 'BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT'); | ||
|
||
return $queries; | ||
} | ||
|
||
/** | ||
* @param Migration[] $queries | ||
* @return Migration[] | ||
*/ | ||
private function getLogProfilingMigrations($queries) | ||
{ | ||
$queries[] = $this->migration->db->addColumn($this->logProfilingTable, 'idprofiling', 'BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT'); | ||
|
||
return $queries; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters