Upgrade v2.16.0 to v3.0.2

Your software
My PHP version is : 7.3

I’m want to upgrade from v2.16.0 to v3.0.2 - I’ve read the following https://docs.mautic.org/en/mautic-3-upgrade/upgrade-steps however this is specifically for upgrading from v2.16.3 or above.

What is the best approach?

Do i need to upgrade to a v2 build e.g. v2.16.3 and then do a further upgrade to v3.0.2 or can I upgrade straight from current to latest version?

1 Like

You must update first to 2.16.3 - there is no other upgrade path. See the pre-flight check:

  • Do you at least have Mautic 2.16.3 installed?

So you will need to do 2.16.0 → 2.16.3 and then you can upgrade to 3.x. Of course, ensuring that you have a backup that is tested, and ideally at the command line.

2 Likes

To confirm the update that is needed initially is this the 2.16.3-update.zip from this page:

Then it’s a case of upgrading using the published steps at:

Correct?

Just use the command:

mautic:update:find

followed by

mautic:update:apply

per the docs here: https://docs.mautic.org/en/setup/updating-at-command-line#checking-for-updates

You will not be offered the 3.x packages unless you are on 2.16.3 so it is fine to use the regular update commands.

Once. at 2.16.3 run the commands again, it will take you through the migration step by step at the command line when you do the update.

1 Like

Great, that all makes sense.

I’ve had to substitute php bin/console mautic:update:find for php app/console mautic:update:find but that has started the process.

It’s unpacked but then thrown up the following:

[Symfony\Component\Debug\Exception\FatalThrowableError]
Type error: Argument 1 passed to Mautic\CoreBundle\Helper\LanguageHelper::__construct() must be an instance of Mautic\CoreBundle\Helper\PathsHelper, instance of Mautic\CoreBundle\Factory\MauticFactory given, called in /home/per/email.domain.com/app/cache/prod/appProdProjectContainer.php on line 11412

There are then the options:

mautic:update:apply [–force] [-p|–update-package [UPDATE-PACKAGE]] [-h|–help] [-q|–quiet] [-v|vv|vvv|–verbose] [-V|–version] [–ansi] [–no-ansi] [-n|–no-interaction] [-s|–shell] [–process-isolation] [-e|–env ENV] [–no-debug] [–]

@rcheesley any help/input from your end massively appreciated.

Hi there,

Search is your friend … it turned up this thread: Impossible to update from 2.16.0.

Try changing the language of your instance to en_US?

Seemingly the language is already set to English - United States

!

Hmmmm…

Any further ideas/suggestions?

Is it worth deleting the contents of /home/per/email.domain.com/app/cache perhaps?

Yes, deleting the cache is a good starting point!

Very strange, although I unpacked previously but didn’t proceed with the upgrade via Terminal, today it’s now showing that Mautic is running 2.16.3 (weird).

So I’ve run php upgrade_v3.php

Then run yes to proceed.

It then says that there is a warning due to pending emails not sent (that i’m not worried about) and that it can’t make a database backup due to restrictions on the system.

It then says only continue if you have your own database backup available! which I do, however I’m unsure what command to run to continue the update…

@voisd you can run php upgrade_v3.php --ignore-warnings which skips these warnings and proceeds with the upgrade. Hope that helps :blush:

1 Like

Ok, so that got it going, it got a little way into the upgrade and then flagged a DROP FOREIGN KEY error.

ALTER TABLE maukf_lead_event_log DROP FOREIGN KEY FK_A73AD4C755458D
Migration 20180329185634 failed during Execution. Error An exception occurred while executing ‘ALTER TABLE maukf_lead_event_log DROP FOREIGN KEY FK_A73AD4C755458D’:

Can’t DROP FOREIGN KEY FK_A73AD4C755458D; check that it exists

[Doctrine\DBAL\Exception\DriverException]
An exception occurred while executing ‘ALTER TABLE maukf_lead_event_log DROP FOREIGN KEY FK_A73AD4C755458D’:

Can’t DROP FOREIGN KEY FK_A73AD4C755458D; check that it exists

[Doctrine\DBAL\Driver\Mysqli\MysqliException]
Can’t DROP FOREIGN KEY FK_A73AD4C755458D; check that it exists

doctrine:migrations:migrate [–write-sql] [–dry-run] [–query-time] [–allow-no-migration] [–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] [-s|–shell] [–process-isolation] [-e|–env ENV] [–no-debug] [–] []

Any next step suggestions?

I’ve since:

Run the steps from this article however stopped prior to trying to update files manually at this stage.

Attempt to add the appropriate missing key (as stated in this article) however all I managed to get was the folllow mySQL error.

Any thoughts/suggestions?

@voisd Apologies for the late reply.

The migration 20180329185634 belongs to Mautic 2, which means that your upgrade is stuck in step 3 of the process: https://docs.mautic.org/en/mautic-3-upgrade/upgrade-steps#3-apply-mautic-2-database-migrations. At this stage, you can still use your Mautic 2 installation as if nothing has happened.

This migration should have been executed in the past already, because it’s two years old: https://github.com/mautic/mautic/tree/2.16/app/migrations - weird that that didn’t happen on your installation.

In order to proceed, we need all database migrations for Mautic 2 executed on your instance. You can trigger that process with app/console doctrine:migrations:migrate, which will most likely give you the error you posted above.

I looked at the specific migration and can you please do the following:

  1. Open app/migrations/Version20180329185634.php
  2. Remove line 32, which has this code in it:
    $this->addSql("ALTER TABLE {$this->prefix}lead_event_log DROP FOREIGN KEY $fkName"); --> please don’t touch other parts of this file!
  3. Run app/console doctrine:migrations:migrate again. Fingers crossed you won’t see any other errors now :crossed_fingers:
  4. If the migrations succeeded, try to open the Mautic 3 upgrade script again.

Hope this helps!

2 Likes

That seems to have done the job - now successfully running 3.0.1 - thanks for your help :smiley:

2 Likes