My Mautic version is: 4.1.11
My PHP version is: 7.4.33
My Database type and version is: 5.7.44
Your problem
I have a docker installation based on mautic:v4. I want to upgrade it to v5 and I was wondering if there’s a guide on how to make this upgrade.
So I couldn’t find any step-by-step guide to performing this upgrade so I’m trying to figure it out on my own.
So far what I got is this:
The files that should survive the container life-cycle are those inside the directories:
media/files
media/images
media/dashboards
Plus the file app/config/local.php.
If you know of any other important user file please let me know (I’m kind of new to Mautic).
So, my idea was to change my docker-compose.yml to reflect this situation instead of mounting the whole /var/www/html directory which will get overwritten by the new version anyway…
Next step: change the image from mautic/mautic:v4 to mautic/mautic:5.0.3-apache and to mysql:8.0 for the database.
Then bring the services up and load a pre-existing database dump in the new container.
Right after that, bring the db up to date with the command php bin/console mautic:update:apply --finish.
I got this far but I got stuck on this error I can’t make sense of:
[error] Migration Mautic\Migrations\Version20230522141144 failed during Pre-Checks. Error: "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."
In Exception.php line 115:
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 th
is 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#getMappedData
baseTypes(). If the type name is empty you might have a problem with the cache or forgot some mapping information.
Made a copy of my server configuration (docker cp mautic.ssl:/var/www/html/app/config/local.php)
Copy the file from the server to my local
Brought the services up using the basic example (docker-compose -f examples/basic/docker-compose.yml up)
Imported the production database into the local container (docker-compose -f examples/basic/docker-compose.yml exec -T db mysql -u mautic_db_user -pmautic_db_pwd mautic_db < mautic.dump.sql)
Run the migrations from within the local container (docker-compose -f examples/basic/docker-compose.yml exec php bin/console mautic:update:apply --finish)
Adjusted the local config
8.1 Replaced the prod URL with localhost
8.2 Replaced the v4 directories (app/* for the structure used in v5)
8.3 Added localhost as trusted_host
After this I was able to visit my local site and have version 5.0.3 working.
I didn’t copy my files nor dashboards but I believe that had I done that it would have worked.
I hope this helps. Haven’t done the full migration in prod, I hope I get to do it soon.
Hi, can you confirmed that this works?
I am new to Mautic and am having an issue with the database not persisting when I update the mautic web container.
I have a separate container for mariadb.
And want to persist the local.php, media files and database.
But every time, it tries to run the setup page on deploy.