@Aardvark8 opened this Pull Request on July 20th 2017

Columns added to support MySQL group replication (every table must have a primary key)

@sgiehl commented on July 21st 2017 Member

Besides changing the schema, there also needs to be an update script, that performs the changes while updating.
Also I'm not sure if INTEGER is the right choice. We are already having issues at other places where INTEGER is simply too small.

@Aardvark8 commented on July 21st 2017

Integer was changed to BIGINT. Where would we place the update script? Which file is best as an example?

@sgiehl commented on July 22nd 2017 Member

See https://github.com/piwik/piwik/tree/3.x-dev/core/Updates
As I don't think this will get merged for 3.0.5, maybe you could name the Update-Script 3.1.0 already.

@Aardvark8 commented on July 22nd 2017

Update script was created core/Updates/3.1.0.php. Hopefully we could be considered for 3.1.0.

@Aardvark8 commented on August 3rd 2017

Tested the update script and it works well. Retested and everything checks out and we are ready for merge.

@Aardvark8 commented on September 18th 2017

Ok, tabs were changed to spaces.

@mattab commented on November 20th 2017 Owner

Hi @Aardvark8

When trying to run the upgrade it fails because there is already one field with auto increment in site_setting table, see:

    The database upgrade process may take a while, so please be patient.

  Executing ALTER TABLE `piwik_plugin_setting` ADD COLUMN `idplugin_setting` BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT;... Done. [1 / 3]
  Executing ALTER TABLE `piwik_site_setting` ADD COLUMN `idsite_setting` BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT;... 
    [X] Critical Error during the update process:

    * core/Updates/3.2.1.php:
    Error trying to execute the migration 'ALTER TABLE `piwik_site_setting` ADD COLUMN `idsite_setting` BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT;'.
@Aardvark8 commented on November 20th 2017

Hi Matt, We do not receive that error. Looking at the file, there does not appear to be any other column in that table with AUTO_INCREMENT. Is it possible, that your tester ran the code twice and received the error on the second run (maybe after adding the primary key column by the original name)?

Powered by GitHub Issue Mirror