Mautic Community Forums

Problems with Mautic 3 migration - M2 database migration fails with error about foreign key

My Mautic version is:2.16.3—> 3.0
My PHP version is:7.3

Your problem
My problem is:

These errors are showing in the log: ERR_MAUTIC_2_MIGRATIONS_FAILED: Oh no! While preparing the upgrade, the so-called ‘database migrations’ for Mautic 2 have failed. Command output: Mautic Migrations Migrating up to 20180329185634 from 20180220212444 ++ migrating 20180329185634 -> ALTER TABLE mau7d_lead_event_log DROP FOREIGN KEY FK_FF95657C55458D Migration 20180329185634 failed during Execution. Error An exception occurred while executing ‘ALTER TABLE mau7d_lead_event_log DROP FOREIGN KEY FK_FF95657C55458D’: Can’t DROP ‘FK_FF95657C55458D’; check that column/key exists [Doctrine\DBAL\Exception\DriverException] An exception occurred while executing ‘ALTER TABLE mau7d_lead_event_log DROP FOREIGN KEY FK_FF95657C55458D’: Can’t DROP ‘FK_FF95657C55458D’; check that column/key exists [Doctrine\DBAL\Driver\Mysqli\MysqliException] Can’t DROP ‘FK_FF95657C55458D’; check that column/key 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] [–] .

Steps I have tried to fix the problem:examined documentation concerning inverse operation of (x/y squared) x pi = q

Put a splint on the bone that broke that holds all the curse words in.

Drank coffee
Walked my dog

Moved to an individual topic instead of a reply to the category description :slight_smile:

Hi there,

Looks like this is an issue with one of the migration scripts in the past.

I found a thread on a Github issue related to this which suggests it is related to a Softaculous install - was yours originnally installed that way?

Here is the proposed solution:

Can you give it a try and let us know?

1 Like

Upgraded MariaDb today from 10.1 to 10.3. Will install a fresh instance of 2.16.2 —> 2.16.3–> 3.0 this evening or tomorrow. Will update post on the progress.

1 Like

Weird space in the error output but didn’t seem relevant to upgrade.
Manually cleared cache
Hit refresh

I’ll check logs in the morning and post anything relevant

Glad to hear that your migration completed! If the cache creation stage failed it would mean a slow first load, but you can get in, it does not seem to have had a negative impact.

From what I can see of the error code it looks like there are some open_basedir restrictions in place on your hosting environment so guessing that is the problem.

Feel free to

reach out with any further questions relating to the upgrade :wink: but going to mark as solved - was it the suggestion from Github that fixed the issue in the end?

adding the key as described solved an error but generated another with its reference to company Id In one table and lead Id in another (cascade on delete restrict on update). Oddly it was same foreign key so when viewing the relational view in myphp and adding another foreign key I never found a combination that allowed a schema update via command line.

I rolled back to 2.16.2 using a snapshot and upgraded mariadb from 10.1.45 to 10.3. Used GUI to upgrade this particular instance to progress from 2.16.2 —>2.16.3–> 3.0
I was never able to address the error manually so I cannot say if upgrading Maria was the fix or not

@EJL Mautic 3 requires MariaDB 10.2 or higher, so that might have caused some issues. We’ll be upgrading the upgrade script to mark MariaDB 10.2 (or MySQL 5.7) as the minimum required database version:

1 Like

@EJL regarding the open_basedir warning: we have found the issue and the fix is ready to be tested:

Thanks for reporting this issue :rocket:

Hi im having trouble with my mautic installation. I’m trying to update and I think my mautic is in between versions 2.6 and 3 because after I began the upgrade from 2.6 it stalled.

I setup the commands.php file as described here:

and when I run any of the commands I see this:

Fatal error : Uncaught Error: Class ‘Symfony\Component\HttpKernel\Kernel’ not found in