# Migration db error during 5.2.6 to 6.0.2 upgrade

**URL:** <https://forum.mautic.org/t/migration-db-error-during-5-2-6-to-6-0-2-upgrade/35897>\
**Category:** Mautic 6 Install/Upgrade Support\
**Created:** [June 19, 2025, 12:39pm UTC](https://forum.mautic.org/t/migration-db-error-during-5-2-6-to-6-0-2-upgrade/35897 "2025-06-19T12:39:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexzlobin](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/alexzlobin/32/13606_2.png) [@alexzlobin](https://forum.mautic.org/u/alexzlobin)\
**Post date:** [June 19, 2025, 12:39pm UTC](https://forum.mautic.org/t/migration-db-error-during-5-2-6-to-6-0-2-upgrade/35897/1 "2025-06-19T12:39:03Z")

</div>

I’t trying to upgrade my installations from 4.4.x to latest 6.0.2 .  
4.4.X to 5.1 ok  
5.1 to 5.2.6 ok  
5.2.6 to 6.0.2 error

I’ve created short manual for reproduce.  
OS: ubuntu 22.04  
php: 8.0 for start  
db: mysql 8.0

1. Upgrade versions of apps  
apt update -y && apt dist-upgrade -y

2. update to actual mautic version - (4.4.11 was on the test server)  
cd {/mauticdirectory}  
wget [https://github.com/mautic/mautic/releases/download/4.4.13/4.4.13-update.zip](https://github.com/mautic/mautic/releases/download/4.4.13/4.4.13-update.zip)  
sudo -u www-data php bin/console mautic:update:apply --update-package=4.4.13-update.zip  
sudo -u www-data php bin/console mautic:update:apply --finish

3. remove custom plugins and unsupported official plugin like MauticRecaptchaBundle

4. update to 5.1.1 version  
wget [https://github.com/mautic/mautic/releases/download/5.1.1/5.1.1-update.zip](https://github.com/mautic/mautic/releases/download/5.1.1/5.1.1-update.zip)  
sudo -u www-data php bin/console mautic:update:apply --update-package=5.1.1-update.zip  
sudo -u www-data php bin/console mautic:update:apply --finish

5. install php 8.2  
apt install php8.2-{apcu,fpm,cli,curl,mysql,mailparse,gd,mbstring,imagick,bcmath,zip,tidy,soap,intl,xml,imap,redis,opcache}

6. change nginx setting for change php version  
nano /etc/nginx/sites-enabled  
change php8.0-fpm to php8.2-fpm

7. del old php 8.0  
apt purge php8.0\*

8. update to 5.2.6 version  
wget [https://github.com/mautic/mautic/releases/download/5.2.6/5.2.6-update.zip](https://github.com/mautic/mautic/releases/download/5.2.6/5.2.6-update.zip)  
sudo -u www-data php bin/console mautic:update:apply --update-package=5.2.6-update.zip  
sudo -u www-data php bin/console mautic:update:apply --finish

9. update to 6.0.2 version  
wget [https://github.com/mautic/mautic/releases/download/6.0.2/6.0.2-update.zip](https://github.com/mautic/mautic/releases/download/6.0.2/6.0.2-update.zip)  
sudo -u www-data php bin/console mautic:update:apply --update-package=6.0.2-update.zip  
sudo -u www-data php bin/console mautic:update:apply --finish

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

Detail error from mautic log  
[2025-06-19T10:27:43.126350+00:00] mautic.CRITICAL: Uncaught PHP Exception TypeError: “Cannot assign \_\_PHP\_Incomplete\_Class to property Symfony\Component\Security\Core\Exception\AuthenticationException::$token of type ?Symfony\Component\Security\Core\Authentication\Token\TokenInterface” at /var/www/mautic/vendor/symfony/security-core/Exception/AuthenticationException.php line 79 {“exception”:“[object] (TypeError(code: 0): Cannot assign \_\_PHP\_Incomplete\_Class to property Symfony\Component\Security\Core\Exception\AuthenticationException::$token of type ?Symfony\Component\Security\Core\Authentication\Token\TokenInterface at /var/www/mautic/vendor/symfony/security-core/Exception/AuthenticationException.php:79)”} {“hostname”:“msb-dev”,“pid”:50290}

Detailed if run manually  
sudo -u www-data php bin/console doctrine:migrations:migrate

WARNING! You are about to execute a migration in database “baza\_ss” that could result in schema changes and data loss. Are you sure you wish to continue? (yes/no) [yes]:

> yes

[WARNING] You have 49 previously executed migrations in the database that are not registered migrations.

> > 2024-01-27 10:33:12 (20180508202930)  
> > 2024-01-27 10:33:13 (20180702014364)  
> > 2024-01-27 10:33:13 (20180702014365)  
> > 2024-01-27 10:33:14 (20180821144204)  
> > 2024-01-27 10:33:15 (20180921144421)  
> > 2024-01-27 10:33:15 (20181111095447)  
> > 2024-01-27 10:33:15 (20190704154940)  
> > 2024-01-27 10:33:17 (20190724110039)  
> > 2024-01-27 10:33:17 (20191017140848)  
> > 2024-01-27 10:33:18 (20191126093923)  
> > 2024-01-27 10:33:18 (20191206113956)  
> > 2024-01-27 10:33:19 (20191219155630)  
> > 2024-01-27 10:33:19 (20200211095409)  
> > 2024-01-27 10:33:20 (20200212141530)  
> > 2024-01-27 10:33:20 (20200220172041)  
> > 2024-01-27 10:33:20 (20200227110431)  
> > 2024-01-27 10:33:20 (20200302164801)  
> > 2024-01-27 10:33:20 (20200331160919)  
> > 2024-01-27 10:33:21 (20200409102100)  
> > 2024-01-27 10:33:21 (20200422144300)  
> > 2024-01-27 10:33:21 (20200507122854)  
> > 2024-01-27 10:33:22 (20200729170800)  
> > 2024-01-27 10:33:23 (20200805185714)  
> > 2024-01-27 10:33:23 (20200810153131)  
> > 2024-01-27 10:33:24 (20200812180900)  
> > 2024-01-27 10:33:24 (20200815153711)  
> > 2024-01-27 10:33:24 (20200924080139)  
> > 2024-01-27 10:33:24 (20201015084627)  
> > 2024-01-27 10:33:24 (20201102120710)  
> > 2024-01-27 10:33:24 (20201102133546)  
> > 2024-01-27 10:33:25 (20201105120328)  
> > 2024-01-27 10:33:25 (20201120122846)  
> > 2024-01-27 10:33:26 (20201123070813)  
> > 2024-01-27 10:33:27 (20201125155904)  
> > 2024-01-27 10:33:27 (20201130201631)  
> > 2024-01-27 10:33:27 (20201207114926)  
> > 2024-01-27 10:33:27 (20201207140911)  
> > 2024-01-27 10:33:27 (20201228041109)  
> > 2024-01-27 10:33:28 (20210104171005)  
> > 2024-01-27 10:33:28 (20210203143600)  
> > 2024-01-27 10:33:29 (20210223174702)  
> > 2024-01-27 10:33:29 (20210502162314)  
> > 2024-01-27 10:33:29 (20210520100503)  
> > 2024-01-27 10:33:30 (20210609191822)  
> > 2024-01-27 10:33:30 (20210614151138)  
> > 2024-01-27 10:33:30 (20210623071326)  
> > 2024-01-27 10:33:31 (20220111202917)  
> > 2024-01-27 10:33:31 (20230519081315)  
> > 2024-01-27 10:33:31 (20230522115137)

Are you sure you wish to continue? (yes/no) [yes]:

> yes

[notice] Migrating up to Mautic\Migrations\Versionzz20230929183000  
[notice] Migration Mautic\Migrations\Version20201026101117 skipped during Pre-Checks. Reason: “Schema includes this migration”  
[notice] The index ss\_company\_match does not exist in the ss\_companies table.  
[error] Migration Mautic\Migrations\Version20211020114811 failed during Execution. Error: “An exception occurred while executing a query: SQLSTATE[42000]: Syntax error or access violation: 1091 Can’t DROP ‘ss\_company\_match’; check that column/key exists”

In ExceptionConverter.php line 117:

An exception occurred while executing a query: SQLSTATE[42000]: Syntax error or access violation: 1091 Can’t DROP ‘ss\_company\_match’; check that column/key exists

In Exception.php line 28:

SQLSTATE[42000]: Syntax error or access violation: 1091 Can’t DROP ‘ss\_company\_match’; check that column/key exists

In Connection.php line 71:

SQLSTATE[42000]: Syntax error or access violation: 1091 Can’t DROP ‘ss\_company\_match’; check that column/key exists

doctrine:migrations:migrate [–write-sql [WRITE-SQL]] [–dry-run] [–query-time] [–allow-no-migration] [–all-or-nothing [ALL-OR-NOTHING]] [–configuration CONFIGURATION] [–em EM] [–conn CONN] [–] []  
sudo -u www-data php bin/console doctrine:migrations:status  
±---------------------±---------------------±-----------------------------------------------------------------------+  
| Configuration |  
±---------------------±---------------------±-----------------------------------------------------------------------+  
| Storage | Type | Doctrine\Migrations\Metadata\Storage\TableMetadataStorageConfiguration |  
| | Table Name | ss\_migrations |  
| | Column Name | version |  
|----------------------------------------------------------------------------------------------------------------------|  
| Database | Driver | Doctrine\DBAL\Driver\PDO\MySQL\Driver |  
| | Name | baza\_ss |  
|----------------------------------------------------------------------------------------------------------------------|  
| Versions | Previous | Mautic\Migrations\Version20240708153845 |  
| | Current | Mautic\Migrations\Versionzz20230929183000 |  
| | Next | Mautic\Migrations\Version20201026101117 |  
| | Latest | Mautic\Migrations\Versionzz20230929183000 |  
|----------------------------------------------------------------------------------------------------------------------|  
| Migrations | Executed | 93 |  
| | Executed Unavailable | 49 |  
| | Available | 63 |  
| | New | 19 |  
|----------------------------------------------------------------------------------------------------------------------|  
| Migration Namespaces | Mautic\Migrations | /var/www/mautic/app/migrations |  
±---------------------±---------------------±-----------------------------------------------------------------------+

---

<div class="post-metadata">

**Author:** ![smd](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/smd/32/13467_2.png) [@smd](https://forum.mautic.org/u/smd)\
**Post date:** [July 17, 2025, 10:58am UTC](https://forum.mautic.org/t/migration-db-error-during-5-2-6-to-6-0-2-upgrade/35897/2 "2025-07-17T10:58:15Z")

</div>

I have exactly the same issue. Did you find an answer?

---

<div class="post-metadata">

**Author:** ![smd](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/smd/32/13467_2.png) [@smd](https://forum.mautic.org/u/smd)\
**Post date:** [July 17, 2025, 11:29am UTC](https://forum.mautic.org/t/migration-db-error-during-5-2-6-to-6-0-2-upgrade/35897/3 "2025-07-17T11:29:34Z")

</div>

I found a solution:  
**First** , run the following commands **without** the `--finish` option:

```auto
php bin/console mautic:update:find
php bin/console mautic:update:apply

```

**Next** , I corrected a wrong version entry in the database.  
**Note** : Replace `_ma` with your actual table prefix.

```auto
INSERT INTO `_mamigrations` (version, executed_at, execution_time) VALUES ('Mautic\\Migrations\\Version20211020114811', NOW(), 0);
INSERT INTO `_mamigrations` (version, executed_at, execution_time) VALUES ('Mautic\\Migrations\\Version20230621074925', NOW(), 0);

```

**Finally** , you can complete the update process:

```auto
php bin/console mautic:update:apply --finish

```

---

<div class="post-metadata">

**Author:** ![alexzlobin](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/alexzlobin/32/13606_2.png) [@alexzlobin](https://forum.mautic.org/u/alexzlobin)\
**Post date:** [July 17, 2025, 1:21pm UTC](https://forum.mautic.org/t/migration-db-error-during-5-2-6-to-6-0-2-upgrade/35897/4 "2025-07-17T13:21:24Z")

</div>

Thanks, @smd I will check it soon

---

<div class="post-metadata">

**Author:** ![alexzlobin](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/alexzlobin/32/13606_2.png) [@alexzlobin](https://forum.mautic.org/u/alexzlobin)\
**Post date:** [July 18, 2025, 3:27pm UTC](https://forum.mautic.org/t/migration-db-error-during-5-2-6-to-6-0-2-upgrade/35897/5 "2025-07-18T15:27:24Z")

</div>

> [@smd](#):
>
> ```auto
> INSERT INTO `_mamigrations` (version, executed_at, execution_time) VALUES ('Mautic\\Migrations\\Version20211020114811', NOW(), 0);
> INSERT INTO `_mamigrations` (version, executed_at, execution_time) VALUES ('Mautic\\Migrations\\Version20230621074925', NOW(), 0);
> 
> ```

It works for me  
Thank you so much
