Error during upgrade from 4.1.1 to 4.1.2

Your software
My PHP version is : 7.4.27
My MySQL/MariaDB version is: MySQL version (MySQL Community Server 8.0.28)

Updating/Installing Errors
I am: Updating
Upgrading via: Command Line

These errors are showing in the installer :
Generic error message

These errors are showing in the Mautic log :

[2022-02-02 18:02:10] console.CRITICAL: Error thrown while running command “doctrine:migrations:migrate --quiet --no-interaction”. Message: “An exception occurred while executing ’ CREATE TABLE mt_campaign_summary ( id INT UNSIGNED AUTO_INCREMENT NOT NULL, campaign_id INT UNSIGNED DEFAULT NULL, event_id INT UNSIGNED NOT NULL, date_triggered DATETIME DEFAULT NULL COMMENT ‘(DC2Type:datetime_immutable)’, scheduled_count INT NOT NULL, triggered_count INT NOT NULL, non_action_path_taken_count INT NOT NULL, failed_count INT NOT NULL, log_counts_processed INT, INDEX IDX_42D3FE64F639F774 (campaign_id), INDEX IDX_42D3FE6471F7E88B (event_id), UNIQUE INDEX campaign_event_date_triggered (campaign_id, event_id, date_triggered), PRIMARY KEY(id) ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB ROW_FORMAT = DYNAMIC; ': SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘mt_campaign_summary’ already exists” {“exception”:"[object] (Doctrine\DBAL\Exception\TableExistsException(code: 0): An exception occurred while executing '\n CREATE TABLE mt_campaign_summary (\n id INT UNSIGNED AUTO_INCREMENT NOT NULL,\n campaign_id INT UNSIGNED DEFAULT NULL,\n event_id INT UNSIGNED NOT NULL,\n date_triggered DATETIME DEFAULT NULL COMMENT ‘(DC2Type:datetime_immutable)’,\n scheduled_count INT NOT NULL,\n triggered_count INT NOT NULL,\n non_action_path_taken_count INT NOT NULL,\n failed_count INT NOT NULL,\n log_counts_processed INT,\n INDEX IDX_42D3FE64F639F774 (campaign_id),\n INDEX IDX_42D3FE6471F7E88B (event_id),\n UNIQUE INDEX campaign_event_date_triggered (campaign_id, event_id, date_triggered),\n PRIMARY KEY(id)\n ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB ROW_FORMAT = DYNAMIC;\n ':\n\nSQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘mt_campaign_summary’ already exists at /var/www/castellino/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:57, Doctrine\DBAL\Driver\PDO\Exception(code: 42S01): SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘mt_campaign_summary’ already exists at /var/www/castellino/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18, PDOException(code: 42S01): SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘mt_campaign_summary’ already exists at /var/www/castellino/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:132)",“command”:“doctrine:migrations:migrate --quiet --no-interaction”,“message”:“An exception occurred while executing '\n CREATE TABLE mt_campaign_summary (\n id INT UNSIGNED AUTO_INCREMENT NOT NULL,\n campaign_id INT UNSIGNED DEFAULT NULL,\n event_id INT UNSIGNED NOT NULL,\n date_triggered DATETIME DEFAULT NULL COMMENT ‘(DC2Type:datetime_immutable)’,\n scheduled_count INT NOT NULL,\n triggered_count INT NOT NULL,\n non_action_path_taken_count INT NOT NULL,\n failed_count INT NOT NULL,\n log_counts_processed INT,\n INDEX IDX_42D3FE64F639F774 (campaign_id),\n INDEX IDX_42D3FE6471F7E88B (event_id),\n UNIQUE INDEX campaign_event_date_triggered (campaign_id, event_id, date_triggered),\n PRIMARY KEY(id)\n ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB ROW_FORMAT = DYNAMIC;\n ':\n\nSQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘mt_campaign_summary’ already exists”}

Your problem
My problem is :

Upgrading from a newly installed version 4.1.1 to version 4.1.2 results in an error while updating the database.
In the log file you can see that it tries to create the table mt_campaign_summary
This table is already present, so I think it shouldn’t be a CREATE TABLE but an ALTER TABLE

Steps I have tried to fix the problem :

Since the current installation is new, and not having created campaigns yet, I could delete the table before starting the procedure, but I doubt that this is the correct procedure

The problem appears to be in the file Version20201120122846.php
Here is the creation of table mt_campaign_summary
If you comment the creation of this table, the update end with success.
I checked the sql to create mt_campaign_summary and the table is the same as in the previous version (4.1.1).
For this reason I assume that the file Version20201120122846.php should not be included in the migrations to upgrade from 4.1.1 to 4.1.2

1 Like

@castellino I think you should submit a github issue on this, as it does look like an issue
@rcheesley

Issue and PRs already exist :slight_smile:

Please see these PRs:

2 Likes