Issue with logging in to mautic 6.0 after upgrade from 5.2.5

Hi Team @rcheesley

When trying to login I am getting this error, I have checked various tables to see that uuid is there. and they are. Am I missing something else ?

Matthew

[2025-05-01T12:03:15.098596+00:00] mautic.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\InvalidFieldNameException: "An exception occurred while executing a query: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'm1_.uuid' in 'SELECT'" at /home/mautic-ssa/webapps/j3mautic-ssa/public/go/vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php line 67 {"exception":"[object] (Doctrine\\DBAL\\Exception\\InvalidFieldNameException(code: 1054): An exception occurred while executing a query: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'm1_.uuid' in 'SELECT' at /home/mautic-ssa/webapps/j3mautic-ssa/public/go/vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php:67)\n[previous exception] [object] (Doctrine\\DBAL\\Driver\\PDO\\Exception(code: 1054): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'm1_.uuid' in 'SELECT' at /home/mautic-ssa/webapps/j3mautic-ssa/public/go/vendor/doctrine/dbal/src/Driver/PDO/Exception.php:28)\n[previous exception] [object] (PDOException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'm1_.uuid' in 'SELECT' at /home/mautic-ssa/webapps/j3mautic-ssa/public/go/vendor/doctrine/dbal/src/Driver/PDO/Statement.php:130)"} {"hostname":"a-srv24-wwm-ubuntu24","pid":459222}

Just a thought, is there a migration which deals with this specifically, if yes, what is the vesion number ?

I searched the GitHub PRs for UUID using this query to find when it was introduced:

There was also a PR to fix some issues:

Both were merged in 6.0.0.

In the first PR I found the migration:

app/migrations/Version20210211081531.php

Then there are two migrations in the second one:

app/migrations/Version20210818090322.php

app/migrations/Version20210819201726.php

If you’ve done an upgrade and the migrations were processed, it should have migrated your database and completed the necessary changes.

I alos searched the issue queue for UUID and found this issue: Missing `uuid` field in Lead entity after updating to 6.0.0-rc Β· Issue #14760 Β· mautic/mautic Β· GitHub which was fixed with the later PR:

Also released with 6.0.0.

@rcheesley Thanks for the info, I have started this again, and seen where this does not work.

Upgrading from v5.2.1 to 5.2.5 results in the migration not happening as I mentioned here, so adding in the missing field works.

Then upgrading from 5.2.5 to 6.0.0 results in this error being shown below.
I have no idea what Integrity constraint violation is, so I am adding the error here, so someone knows what to do.

[2025-05-06T11:46:29.880888+00:00] console.CRITICAL: Error thrown while running command "doctrine:migrations:migrate --quiet --no-interaction". Message: "An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 4025 CONSTRAINT `mautic_emails.headers` failed for `mautic_xxxxx`.`mautic_emails`" {"exception":"[object] (Doctrine\\DBAL\\Exception\\DriverException(code: 4025): An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 4025 CONSTRAINT `mautic_emails.headers` failed for `mautic_xxxxx`.`mautic_emails` at /home/mautic-xxxx/webapps/j3mautic/public/go/vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php:117)\n[previous exception] [object] (Doctrine\\DBAL\\Driver\\PDO\\Exception(code: 4025): SQLSTATE[23000]: Integrity constraint violation: 4025 CONSTRAINT `mautic_emails.headers` failed for `mautic_xxxxx`.`mautic_emails` at /home/mautic-xxxx/webapps/j3mautic/public/go/vendor/doctrine/dbal/src/Driver/PDO/Exception.php:28)\n[previous exception] [object] (PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 4025 CONSTRAINT `mautic_emails.headers` failed for `mautic_xxxxx`.`mautic_emails` at /home/mautic-xxxx/webapps/j3mautic/public/go/vendor/doctrine/dbal/src/Driver/PDO/Connection.php:71)","command":"doctrine:migrations:migrate --quiet --no-interaction","message":"An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 4025 CONSTRAINT `mautic_emails.headers` failed for `mautic_xxxxx`.`mautic_emails`"} {"hostname":"a-srv24-wwm-ubuntu24","pid":1942844}

Since I know this has to do with uuid field missing on certain tables, I have done a compare of the tables from a new v6.0.0 install and identified the following tables, which have the field uuid.

mautic_assets
mautic_campaigns
mautic_campaign_events
mautic_categories
mautic_dynamic_content
mautic_emails
mautic_focus
mautic_forms
mautic_form_actions
mautic_form_fields
mautic_lead_fields
mautic_lead_lists
mautic_lead_tags
mautic_messages
mautic_message_channels
mautic_monitoring
mautic_pages
mautic_permissions
mautic_points
mautic_point_trigger_events
mautic_point_triggers
mautic_push_notifications
mautic_reports
mautic_roles
mautic_sms_messages
mautic_stages

I am assuming the migration did not run, due to the error. So I manually ran the following command to add the uuid field to the tables.

ALTER TABLE mautic_assets ADD COLUMN `uuid` char(36) DEFAULT NULL;
ALTER TABLE mautic_campaigns ADD COLUMN `uuid` char(36) DEFAULT NULL;
ALTER TABLE mautic_campaign_events ADD COLUMN `uuid` char(36) DEFAULT NULL;
ALTER TABLE mautic_categories ADD COLUMN `uuid` char(36) DEFAULT NULL;
ALTER TABLE mautic_dynamic_content ADD COLUMN `uuid` char(36) DEFAULT NULL;
ALTER TABLE mautic_emails ADD COLUMN `uuid` char(36) DEFAULT NULL;
ALTER TABLE mautic_focus ADD COLUMN `uuid` char(36) DEFAULT NULL;
ALTER TABLE mautic_forms ADD COLUMN `uuid` char(36) DEFAULT NULL;
ALTER TABLE mautic_form_actions ADD COLUMN `uuid` char(36) DEFAULT NULL;
ALTER TABLE mautic_form_fields ADD COLUMN `uuid` char(36) DEFAULT NULL;
ALTER TABLE mautic_lead_fields ADD COLUMN `uuid` char(36) DEFAULT NULL;
ALTER TABLE mautic_lead_lists ADD COLUMN `uuid` char(36) DEFAULT NULL;
ALTER TABLE mautic_lead_tags ADD COLUMN `uuid` char(36) DEFAULT NULL;
ALTER TABLE mautic_messages ADD COLUMN `uuid` char(36) DEFAULT NULL;
ALTER TABLE mautic_message_channels ADD COLUMN `uuid` char(36) DEFAULT NULL;
ALTER TABLE mautic_monitoring ADD COLUMN `uuid` char(36) DEFAULT NULL;
ALTER TABLE mautic_pages ADD COLUMN `uuid` char(36) DEFAULT NULL;
ALTER TABLE mautic_permissions ADD COLUMN `uuid` char(36) DEFAULT NULL;
ALTER TABLE mautic_points ADD COLUMN `uuid` char(36) DEFAULT NULL;
ALTER TABLE mautic_point_trigger_events ADD COLUMN `uuid` char(36) DEFAULT NULL;
ALTER TABLE mautic_point_triggers ADD COLUMN `uuid` char(36) DEFAULT NULL;
ALTER TABLE mautic_push_notifications ADD COLUMN `uuid` char(36) DEFAULT NULL;
ALTER TABLE mautic_reports ADD COLUMN `uuid` char(36) DEFAULT NULL;
ALTER TABLE mautic_roles ADD COLUMN `uuid` char(36) DEFAULT NULL;
ALTER TABLE mautic_sms_messages ADD COLUMN `uuid` char(36) DEFAULT NULL;
ALTER TABLE mautic_stages ADD COLUMN `uuid` char(36) DEFAULT NULL;

Once this was done, I could log back into the mautic instance.
I hope this helps anyone with the same issues.
Matthew

1 Like

Thanks @raramuridesign I’ll flag it up in the Mautic 6 channel to see if anyone else is coming across this issue.

To be clear, the migration was only present from the release that the PRs were merged into, ie 6.0.0. So it wouldn’t run in Mautic 5 because the UUID field was introduced in Mautic 6. So you will only be running that migration when you go from 5 β†’ 6.

@rcheesley Thank you.
I see there is a new 6 version today, and there is an improvement on migrations. I will let you know how this goes.
Matthew

1 Like

@rcheesley So we have upgraded several mautic version to v6.0.1-

We get 2 issues, but the one which I think relates to this is the error below.
I can see what the issue is and can confirm that this does not exist, but it would be good if these errors did not show when an upgrade was performed. It throws some doubt into the process.

Can’t DROP INDEX m5company_match; check that it exists

Full error below.
Otherwise it all seemed to work without issues.
Matthew

[2025-05-07T08:27:36.038863+00:00] console.CRITICAL: Error thrown while running command "doctrine:migrations:migrate --quiet --no-interaction". Message: "An exception occurred while executing a query: SQLSTATE[42000]: Syntax error or access violation: 1091 **Can't DROP INDEX `m5company_match`; check that it exists"** {"exception":"[object] (Doctrine\\DBAL\\Exception\\DriverException(code: 1091): An exception occurred while executing a query: SQLSTATE[42000]: Syntax error or access violation: 1091 **Can't DROP INDEX `m5company_match`;** check that it exists at /home/mautic-client/webapps/mautic/public/vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php:117)\n[previous exception] [object] (Doctrine\\DBAL\\Driver\\PDO\\Exception(code: 1091): SQLSTATE[42000]: Syntax error or access violation: 1091 **Can't DROP INDEX `m5company_match`; check that it exists** at /home/mautic-client/webapps/mautic/public/vendor/doctrine/dbal/src/Driver/PDO/Exception.php:28)\n[previous exception] [object] (PDOException(code: 42000): SQLSTATE[42000]: Syntax error or access violation: 1091 **Can't DROP INDEX `m5company_match`;** check that it exists at /home/mautic-client/webapps/mautic/public/vendor/doctrine/dbal/src/Driver/PDO/Connection.php:71)","command":"doctrine:migrations:migrate --quiet --no-interaction","message":"An exception occurred while executing a query: SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP INDEX `m5company_match`; check that it exists"} {"hostname":"a-xxx","pid":232815}

Same issue mentioned here
++ Error running migrations
++ Console doctrine:schema:update --no-interaction --force