Migration from Mautic 4 to 5

Hello community:

Before updating to Mautic 5, is there a way to check the compatibility of the plugins currently used on my Mautic 4 installation?

Is there any documentation on upgrading from Mautic 4 to Mautic 5?

Here you go

How to update Mautic — Mautic Documentation 0.1 documentation

Hello, can you tell how to upgrade the database? I’ve created a new instance (no in-line upgrade) running 5.x and like to migrate my data from my 4.x installation. So i dumped the DB and reimported it on the new DB host. For sure i need to adopt the schema, but how?

For example, i’m getting this error

[2024-05-14T06:18:02.277180+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 'n0_.deduplicate' in 'field list'" at /var/www/html/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 'n0_.deduplicate' in 'field list' at /var/www/html/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 'n0_.deduplicate' in 'field list' at /var/www/html/vendor/doctrine/dbal/src/Driver/PDO/Exception.php:28)\n[previous exception] [object] (PDOException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'n0_.deduplicate' in 'field list' at /var/www/html/vendor/doctrine/dbal/src/Driver/PDO/Connection.php:71)"} {"hostname":"mautic.mydomain.com","pid":22}
[2024-05-14T06:18:02.280884+00:00] mautic.CRITICAL: Exception thrown when handling an exception (InvalidArgumentException: The HTTP status code "1054" is not valid. at /var/www/html/vendor/symfony/http-foundation/Response.php line 470) {"exception":"[object] (InvalidArgumentException(code: 0): The HTTP status code \"1054\" is not valid. at /var/www/html/vendor/symfony/http-foundation/Response.php:470)"} {"hostname":"mautic.mydomain.com","pid":22}

We’re experiencing the same issue. Currenty we’re running on version 4.4.11 and tried to upgrade to 5.0.1, 5.0.3 and 5.1.0 always resulting int the same errors.

The Dashboard page works, but everything else runs into a Internal Server Error.

[2024-06-27T14:58:00.357889+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 'l0_.last_built_time' in 'field list'" at /var/www/vhosts/xxx/oi.xxx/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 'l0_.last_built_time' in 'field list' at /var/www/vhosts/xxx/oi.xxx/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 'l0_.last_built_time' in 'field list' at /var/www/vhosts/xxx/oi.xxx/vendor/doctrine/dbal/src/Driver/PDO/Exception.php:28)\n[previous exception] [object] (PDOException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'l0_.last_built_time' in 'field list' at /var/www/vhosts/xxx/oi.xxx/vendor/doctrine/dbal/src/Driver/PDO/Connection.php:71)"} {"hostname":"mse4.xxx","pid":1579776}
[2024-06-27T14:58:01.567473+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 'l0_.last_built_time' in 'field list'" at /var/www/vhosts/xxx/oi.xxx/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 'l0_.last_built_time' in 'field list' at /var/www/vhosts/xxx/oi.xxx/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 'l0_.last_built_time' in 'field list' at /var/www/vhosts/xxx/oi.xxx/vendor/doctrine/dbal/src/Driver/PDO/Exception.php:28)\n[previous exception] [object] (PDOException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'l0_.last_built_time' in 'field list' at /var/www/vhosts/xxx/oi.xxx/vendor/doctrine/dbal/src/Driver/PDO/Connection.php:71)"} {"hostname":"mse4.xxx","pid":1579776}
[2024-06-27T14:58:05.470556+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 'n0_.deduplicate' in 'field list'" at /var/www/vhosts/xxx/oi.xxx/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 'n0_.deduplicate' in 'field list' at /var/www/vhosts/xxx/oi.xxx/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 'n0_.deduplicate' in 'field list' at /var/www/vhosts/xxx/oi.xxx/vendor/doctrine/dbal/src/Driver/PDO/Exception.php:28)\n[previous exception] [object] (PDOException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'n0_.deduplicate' in 'field list' at /var/www/vhosts/xxx/oi.xxx/vendor/doctrine/dbal/src/Driver/PDO/Connection.php:71)"} {"hostname":"mse4.xxx","pid":1579776}

Already the upgrade ( user@mse4:~/oi.xxx$ /opt/plesk/php/8.0/bin/php -d memory_limit=-1 bin/console mautic:update:apply --finish fails with the same issue

Step    2 [->--------------------------] Migriere das Datenbankschema...

Bei der Aktualisierung der Datenbank ist ein Fehler aufgetreten. Mehr Informationen finden Sie in den Logs.

[2024-06-27T14:54:52.420881+00:00] console.CRITICAL: Error thrown while running command "doctrine:migrations:migrate --quiet --no-interaction". Message: "Unknown column type "json_array" requested. Any Doctrine type that you use has to be registered with \Doctrine\DBAL\Types\Type::addType(). You can get a list of all the known types with \Doctrine\DBAL\Types\Type::getTypesMap(). If this error occurs during database introspection then you might have forgotten to register all database types for a Doctrine Type. Use AbstractPlatform#registerDoctrineTypeMapping() or have your custom types implement Type#getMappedDatabaseTypes(). If the type name is empty you might have a problem with the cache or forgot some mapping information." {"exception":"[object] (Doctrine\\DBAL\\Exception(code: 0): Unknown column type \"json_array\" requested. Any Doctrine type that you use has to be registered with \\Doctrine\\DBAL\\Types\\Type::addType(). You can get a list of all the known types with \\Doctrine\\DBAL\\Types\\Type::getTypesMap(). If this error occurs during database introspection then you might have forgotten to register all database types for a Doctrine Type. Use AbstractPlatform#registerDoctrineTypeMapping() or have your custom types implement Type#getMappedDatabaseTypes(). If the type name is empty you might have a problem with the cache or forgot some mapping information. at /var/www/vhosts/xxx/oi.xxx/vendor/doctrine/dbal/src/Exception.php:115)","command":"doctrine:migrations:migrate --quiet --no-interaction","message":"Unknown column type \"json_array\" requested. Any Doctrine type that you use has to be registered with \\Doctrine\\DBAL\\Types\\Type::addType(). You can get a list of all the known types with \\Doctrine\\DBAL\\Types\\Type::getTypesMap(). If this error occurs during database introspection then you might have forgotten to register all database types for a Doctrine Type. Use AbstractPlatform#registerDoctrineTypeMapping() or have your custom types implement Type#getMappedDatabaseTypes(). If the type name is empty you might have a problem with the cache or forgot some mapping information."} {"hostname":"mse4.xxx","pid":1578976}
[2024-06-27T14:54:52.420622+00:00] mautic.ERROR: Doctrine\DBAL\Exception: Unknown column type "json_array" requested. Any Doctrine type that you use has to be registered with \Doctrine\DBAL\Types\Type::addType(). You can get a list of all the known types with \Doctrine\DBAL\Types\Type::getTypesMap(). If this error occurs during database introspection then you might have forgotten to register all database types for a Doctrine Type. Use AbstractPlatform#registerDoctrineTypeMapping() or have your custom types implement Type#getMappedDatabaseTypes(). If the type name is empty you might have a problem with the cache or forgot some mapping information. (uncaught exception) at /var/www/vhosts/xxx/oi.xxx/vendor/doctrine/dbal/src/Exception.php line 115 while running console command `doctrine:migrations:migrate` [stack trace] #0 /var/www/vhosts/xxx/oi.xxx/vendor/doctrine/dbal/src/Types/TypeRegistry.php(41): Doctrine\DBAL\Exception::unknownColumnType() #1 /var/www/vhosts/xxx/oi.xxx/vendor/doctrine/dbal/src/Types/Type.php(138): Doctrine\DBAL\Types\TypeRegistry->get() #2 /var/www/vhosts/xxx/oi.xxx/vendor/doctrine/dbal/src/Schema/MySQLSchemaManager.php(279): Doctrine\DBAL\Types\Type::getType() #3 /var/www/vhosts/xxx/oi.xxx/vendor/doctrine/dbal/src/Schema/AbstractSchemaManager.php(1408): Doctrine\DBAL\Schema\MySQLSchemaManager->_getPortableTableColumnDefinition() #4 /var/www/vhosts/xxx/oi.xxx/vendor/doctrine/dbal/src/Schema/AbstractSchemaManager.php(423): Doctrine\DBAL\Schema\AbstractSchemaManager->_getPortableTableColumnList() #5 /var/www/vhosts/xxx/oi.xxx/vendor/doctrine/dbal/src/Schema/MySQLSchemaManager.php(66): Doctrine\DBAL\Schema\AbstractSchemaManager->doListTables() #6 /var/www/vhosts/xxx/oi.xxx/vendor/doctrine/dbal/src/Schema/AbstractSchemaManager.php(1651): Doctrine\DBAL\Schema\MySQLSchemaManager->listTables() #7 /var/www/vhosts/xxx/oi.xxx/vendor/doctrine/dbal/src/Schema/AbstractSchemaManager.php(1663): Doctrine\DBAL\Schema\AbstractSchemaManager->createSchema() #8 /var/www/vhosts/xxx/oi.xxx/vendor/doctrine/migrations/lib/Doctrine/Migrations/Provider/DBALSchemaDiffProvider.php(39): Doctrine\DBAL\Schema\AbstractSchemaManager->introspectSchema() #9 /var/www/vhosts/xxx/oi.xxx/vendor/doctrine/migrations/lib/Doctrine/Migrations/Provider/LazySchemaDiffProvider.php(52): Doctrine\Migrations\Provider\DBALSchemaDiffProvider->createFromSchema() #10 /var/www/vhosts/xxx/oi.xxx/vendor/friendsofphp/proxy-manager-lts/src/ProxyManager/GeneratorStrategy/EvaluatingGeneratorStrategy.php(54) : eval()'d code(47): Doctrine\Migrations\Provider\LazySchemaDiffProvider::Doctrine\Migrations\Provider\{closure}() #11 /var/www/vhosts/xxx/oi.xxx/vendor/friendsofphp/proxy-manager-lts/src/ProxyManager/GeneratorStrategy/EvaluatingGeneratorStrategy.php(54) : eval()'d code(47): Closure->__invoke() #12 /var/www/vhosts/xxx/oi.xxx/app/migrations/Version20190326190241.php(20): ProxyManagerGeneratedProxy\__PM__\Doctrine\DBAL\Schema\Schema\Generated1c0295da6c2e186b1708c8dde72ae7fa->getTable() #13 /var/www/vhosts/xxx/oi.xxx/vendor/doctrine/migrations/lib/Doctrine/Migrations/Version/DbalExecutor.php(151): Mautic\Migrations\Version20190326190241->preUp() #14 /var/www/vhosts/xxx/oi.xxx/vendor/doctrine/migrations/lib/Doctrine/Migrations/Version/DbalExecutor.php(96): Doctrine\Migrations\Version\DbalExecutor->executeMigration() #15 /var/www/vhosts/xxx/oi.xxx/vendor/doctrine/migrations/lib/Doctrine/Migrations/DbalMigrator.php(107): Doctrine\Migrations\Version\DbalExecutor->execute() #16 /var/www/vhosts/xxx/oi.xxx/vendor/doctrine/migrations/lib/Doctrine/Migrations/DbalMigrator.php(71): Doctrine\Migrations\DbalMigrator->executePlan() #17 /var/www/vhosts/xxx/oi.xxx/vendor/doctrine/migrations/lib/Doctrine/Migrations/DbalMigrator.php(157): Doctrine\Migrations\DbalMigrator->executeMigrations() #18 /var/www/vhosts/xxx/oi.xxx/vendor/doctrine/migrations/lib/Doctrine/Migrations/Tools/Console/Command/MigrateCommand.php(211): Doctrine\Migrations\DbalMigrator->migrate() #19 /var/www/vhosts/xxx/oi.xxx/vendor/symfony/console/Command/Command.php(298): Doctrine\Migrations\Tools\Console\Command\MigrateCommand->execute() #20 /var/www/vhosts/xxx/oi.xxx/vendor/symfony/console/Application.php(1058): Symfony\Component\Console\Command\Command->run() #21 /var/www/vhosts/xxx/oi.xxx/vendor/symfony/framework-bundle/Console/Application.php(96): Symfony\Component\Console\Application->doRunCommand() #22 /var/www/vhosts/xxx/oi.xxx/vendor/symfony/console/Application.php(301): Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() #23 /var/www/vhosts/xxx/oi.xxx/vendor/symfony/framework-bundle/Console/Application.php(82): Symfony\Component\Console\Application->doRun() #24 /var/www/vhosts/xxx/oi.xxx/vendor/symfony/console/Application.php(171): Symfony\Bundle\FrameworkBundle\Console\Application->doRun() #25 /var/www/vhosts/xxx/oi.xxx/app/bundles/CoreBundle/Update/Step/UpdateSchemaStep.php(51): Symfony\Component\Console\Application->run() #26 /var/www/vhosts/xxx/oi.xxx/app/bundles/CoreBundle/Command/ApplyUpdatesCommand.php(137): Mautic\CoreBundle\Update\Step\UpdateSchemaStep->execute() #27 /var/www/vhosts/xxx/oi.xxx/app/bundles/CoreBundle/Command/ApplyUpdatesCommand.php(99): Mautic\CoreBundle\Command\ApplyUpdatesCommand->finishUpgrade() #28 /var/www/vhosts/xxx/oi.xxx/vendor/symfony/console/Command/Command.php(298): Mautic\CoreBundle\Command\ApplyUpdatesCommand->execute() #29 /var/www/vhosts/xxx/oi.xxx/vendor/symfony/console/Application.php(1058): Symfony\Component\Console\Command\Command->run() #30 /var/www/vhosts/xxx/oi.xxx/vendor/symfony/framework-bundle/Console/Application.php(96): Symfony\Component\Console\Application->doRunCommand() #31 /var/www/vhosts/xxx/oi.xxx/vendor/symfony/console/Application.php(301): Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() #32 /var/www/vhosts/xxx/oi.xxx/vendor/symfony/framework-bundle/Console/Application.php(82): Symfony\Component\Console\Application->doRun() #33 /var/www/vhosts/xxx/oi.xxx/vendor/symfony/console/Application.php(171): Symfony\Bundle\FrameworkBundle\Console\Application->doRun() #34 /var/www/vhosts/xxx/oi.xxx/bin/console(16): Symfony\Component\Console\Application->run() #35 {main} [] {"hostname":"mse4.xxx","pid":1578976}
[2024-06-27T14:54:52.421128+00:00] mautic.WARNING: Command `doctrine:migrations:migrate` exited with status code 1 [] {"hostname":"mse4.xxx","pid":1578976}
[2024-06-27T14:54:52.428521+00:00] mautic.WARNING: Command `mautic:update:apply` exited with status code 1 [] {"hostname":"mse4.xxx","pid":1578976}
[2024-06-27T14:56:06.634305+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 'l0_.is_index' in 'field list'" at /var/www/vhosts/xxx/oi.xxx/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 'l0_.is_index' in 'field list' at /var/www/vhosts/xxx/oi.xxx/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 'l0_.is_index' in 'field list' at /var/www/vhosts/xxx/oi.xxx/vendor/doctrine/dbal/src/Driver/PDO/Exception.php:28)\n[previous exception] [object] (PDOException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'l0_.is_index' in 'field list' at /var/www/vhosts/xxx/oi.xxx/vendor/doctrine/dbal/src/Driver/PDO/Statement.php:130)"} {"hostname":"mse4.xxx","pid":1579575}
[2024-06-27T14:56:06.955032+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 'l0_.is_index' in 'field list'" at /var/www/vhosts/xxx/oi.xxx/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 'l0_.is_index' in 'field list' at /var/www/vhosts/xxx/oi.xxx/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 'l0_.is_index' in 'field list' at /var/www/vhosts/xxx/oi.xxx/vendor/doctrine/dbal/src/Driver/PDO/Exception.php:28)\n[previous exception] [object] (PDOException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'l0_.is_index' in 'field list' at /var/www/vhosts/xxx/oi.xxx/vendor/doctrine/dbal/src/Driver/PDO/Statement.php:130)"} {"hostname":"mse4.xxx","pid":1579575}


Ok, lets go step by step here- First update to the latest version to Mautic 4.

Before moving to upgrading to Mautic 5, make sure all the migrations from Mautic 4 are applied.

The upgrade failed on the minor updates back then also already, can you help me out - what’s the command for upgrading to a specific release? As you know the normal upgrade path just shows the latest version.

Hi,

for upgrade to specific release it would be something like php bin/console mautic:update:apply --update-package=/path/to/updatepackage.zip

you get the package from GH: https://github.com/mautic/mautic/releases/download/4.4.12/4.4.12-update.zip

If upgrade fails you have to investigate why, output above suggests there was a problem with migrations. The next step would be to figure out which migration file is causing problems.

What about you perform a migration by installing Mautic 5 in a sub domain VPS then restore db and other files.

Install the plugin one after the other and if anything break you know which plugin.

You can check respective plugin repository to know if they support v5.