DB error when upgrading from 4.1.2 to 4.4.2

Your software
My PHP version is : 7.4
My MySQL/MariaDB version is (delete as applicable): 10.3.36-MariaDB / mysqli

I am getting the following errors when upgrading from 4.1.2 to 4.4.2 using command line. Luckily I am doing this on a staging site first. What can I do to get the update to go through?

[root@host02]# php bin/console mautic:update:find
Version 4.4.2 of Mautic is available for download. Please visit Release Mautic Community 4.4.2 · mautic/mautic · GitHub for more information.
To update, you can run ‘php bin/console mautic:update:apply’ from the command line.

[root@host02]# php bin/console mautic:update:apply
Are you sure you wish to update Mautic to the latest version? y
Step 5 [---->---------------] Removing deleted files

IMPORTANT: Run the same command again with --finish. For example ‘php bin/console mautic:update:apply --finish’

[root@host02]# php bin/console mautic:update:apply --finish
Step 1 [>---------------------------] Migrating database schema…

An error occurred while updating the database. Check log for more details.

[root@host02]# php bin/console doctrine:migration:status

== Configuration

>> Name:                                               Mautic Migrations
>> Database Driver:                                    mysqli
>> Database Host:                                      localhost
>> Database Name:                                      hidden
>> Configuration Source:                               manually configured
>> Version Table Name:                                 maupt_migrations
>> Version Column Name:                                version
>> Migrations Namespace:                               Mautic\Migrations
>> Migrations Directory:                               /home/app/migrations
>> Previous Version:                                   2020-11-20 12:28:46 (20201120122846)
>> Current Version:                                    2020-11-23 07:08:13 (20201123070813)
>> Next Version:                                       2020-11-25 15:59:04 (20201125155904)
>> Latest Version:                                     2022-01-11 20:29:17 (20220111202917)
>> Executed Migrations:                                33
>> Executed Unavailable Migrations:                    0
>> Available Migrations:                               47
>> New Migrations:                                     14

[root@host02]# php bin/console doctrine:migration:migrate

                Mautic Migrations

WARNING! You are about to execute a database migration that could result in schema changes and data loss. Are you sure you wish to continue? (y/n)y

Migrating up to 20220111202917 from 20201123070813

++ migrating 20201125155904

 -> ALTER TABLE `maupt_lead_event_log` RENAME INDEX `IDX_SEARCH` TO `maupt_IDX_SEARCH`

Migration 20201125155904 failed during Execution. Error An exception occurred while executing ‘ALTER TABLE maupt_lead_event_log RENAME INDEX IDX_SEARCH TO maupt_IDX_SEARCH’:

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘INDEX IDX_SEARCH TO maupt_IDX_SEARCH’ at line 1

In AbstractMySQLDriver.php line 98:

An exception occurred while executing ‘ALTER TABLE maupt_lead_event_log R
ENAME INDEX IDX_SEARCH TO maupt_IDX_SEARCH’:

You have an error in your SQL syntax; check the manual that corresponds to
your MariaDB server version for the right syntax to use near ‘INDEX IDX_SE ARCH TO maupt_IDX_SEARCH’ at line 1

In ConnectionError.php line 21:

You have an error in your SQL syntax; check the manual that corresponds to
your MariaDB server version for the right syntax to use near ‘INDEX IDX_SE ARCH TO maupt_IDX_SEARCH’ at line 1

doctrine:migrations:migrate [–write-sql [WRITE-SQL]] [–dry-run] [–query-time] [–allow-no-migration] [–all-or-nothing [ALL-OR-NOTHING]] [–configuration [CONFIGURATION]][–db-configuration [DB-CONFIGURATION]] [–db DB] [–em EM] [–shard SHARD] [-h|–help] [-q|–quiet] [-v|vv|vvv|–verbose] [-V|–version] [–ansi] [–no-ansi] [-n|–no-interaction] [-e|–env ENV] [–no-debug] [–] []

@gathh - I think I steamrolled through the same error here, possibly causing other problems - who the hell knows or cares at this point.

Yea, it’s very annoying and frustrating that these updates are not running smoothly at all and there doesn’t seem to be any solution :frowning:

1 Like

Does anybody have a solution to this? Really frustrating that we cannot upgrade. :thinking:

What do you recommend we do?

@gathh - as explained in the comment I linked earlier I steamrolled through a similar error using the following with failing queries from the upgrade script:

SET foreign_key_checks = 0;
-- run some queries
SET foreign_key_checks = 1;

I fixed - hopefully… - another problem here by optimizing/fixing the table that was causing problems via PHPMyAdmin.

That issue apparently has something to do with using InnoDB vs MYISAM as engine and different charsets and collation. One has limits on the size of keys and that is causing all these foreign keys violations all over the place, I guess.

But no word on any of that from Mautic developers so far.

Thank you - yes, it would be good to get some feedback from Mautic developers. Those ‘hacks’ are really just hacks.

1 Like