# DB error when upgrading from 4.1.2 to 4.4.2

**URL:** <https://forum.mautic.org/t/db-error-when-upgrading-from-4-1-2-to-4-4-2/25517>\
**Category:** Mautic 4 Install/Upgrade Support\
**Created:** [September 27, 2022, 9:06am UTC](https://forum.mautic.org/t/db-error-when-upgrading-from-4-1-2-to-4-4-2/25517 "2022-09-27T09:06:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![gathh](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/gathh/32/6515_2.png) [@gathh](https://forum.mautic.org/u/gathh)\
**Post date:** [September 27, 2022, 9:06am UTC](https://forum.mautic.org/t/db-error-when-upgrading-from-4-1-2-to-4-4-2/25517/1 "2022-09-27T09:06:23Z")

</div>

**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](https://github.com/mautic/mautic/releases/tag/4.4.2) 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] [–] []

---

<div class="post-metadata">

**Author:** ![modifiedcontent](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/modifiedcontent/32/511_2.png) [@modifiedcontent](https://forum.mautic.org/u/modifiedcontent)\
**Post date:** [September 28, 2022, 6:06pm UTC](https://forum.mautic.org/t/db-error-when-upgrading-from-4-1-2-to-4-4-2/25517/2 "2022-09-28T18:06:02Z")

</div>

@gathh - I think I [steamrolled through the same error here](https://forum.mautic.org/t/as-usual-upgrade-to-4-2-2-this-time-effed-up-my-installation/24106/13), possibly causing [other problems](https://forum.mautic.org/t/csv-imports-fail-stalling-in-progress-runtime-less-than-1-second/25199/9) - who the hell knows or cares at this point.

---

<div class="post-metadata">

**Author:** ![gathh](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/gathh/32/6515_2.png) [@gathh](https://forum.mautic.org/u/gathh)\
**Post date:** [September 29, 2022, 4:11am UTC](https://forum.mautic.org/t/db-error-when-upgrading-from-4-1-2-to-4-4-2/25517/3 "2022-09-29T04:11:37Z")

</div>

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 ☹

---

<div class="post-metadata">

**Author:** ![gathh](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/gathh/32/6515_2.png) [@gathh](https://forum.mautic.org/u/gathh)\
**Post date:** [October 4, 2022, 4:35am UTC](https://forum.mautic.org/t/db-error-when-upgrading-from-4-1-2-to-4-4-2/25517/4 "2022-10-04T04:35:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gathh](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/gathh/32/6515_2.png) [@gathh](https://forum.mautic.org/u/gathh)\
**Post date:** [October 17, 2022, 3:52am UTC](https://forum.mautic.org/t/db-error-when-upgrading-from-4-1-2-to-4-4-2/25517/5 "2022-10-17T03:52:26Z")

</div>

What do you recommend we do?

---

<div class="post-metadata">

**Author:** ![modifiedcontent](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/modifiedcontent/32/511_2.png) [@modifiedcontent](https://forum.mautic.org/u/modifiedcontent)\
**Post date:** [October 17, 2022, 7:51am UTC](https://forum.mautic.org/t/db-error-when-upgrading-from-4-1-2-to-4-4-2/25517/6 "2022-10-17T07:51:03Z")

</div>

@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:

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

```

I fixed - hopefully… - another problem [here](https://forum.mautic.org/t/csv-imports-fail-stalling-in-progress-runtime-less-than-1-second/25199/15) 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.

---

<div class="post-metadata">

**Author:** ![gathh](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/gathh/32/6515_2.png) [@gathh](https://forum.mautic.org/u/gathh)\
**Post date:** [October 17, 2022, 8:11am UTC](https://forum.mautic.org/t/db-error-when-upgrading-from-4-1-2-to-4-4-2/25517/7 "2022-10-17T08:11:14Z")

</div>

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