Your software
My Mautic version is: 2.16.0
My PHP version is: 7.1.33
Your problem
My problem is:
I received errors in my log file after the upgrade to 2.16.0.
[2020-02-19 00:10:36] mautic.ERROR: SCHEMA ERROR: An exception occurred while executing ‘SELECT f.alias, f.is_unique_identifer as is_unique, f.type, f.object FROM ma_lead_fields f WHERE f.object = ‘lead’ ORDER BY f.field_order ASC’: SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘mautic.ma_lead_fields’ doesn’t exist
[2020-02-19 19:16:53] mautic.NOTICE: Doctrine\DBAL\Exception\DriverException: An exception occurred while executing ‘ALTER TABLE ma_lead_event_log DROP FOREIGN KEY FK_3364E8F155458D’: SQLSTATE[42000]: Syntax error or access violation: 1091 Can’t DROP ‘FK_3364E8F155458D’; check that column/key exists (uncaught exception) at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 115 while running console command doctrine:migrations:migrate
It appears that the first error is not an issue and has been around for a few errors. The second error seems to be a concern as I don’t think the migration is completing.
If I manually run the migration I get the following errors in regards to missing Foreign keys.
Migrating up to 20190715065013 from 20180220212444
++ migrating 20180329185634
-> ALTER TABLE ma_lead_event_log DROP FOREIGN KEY FK_3364E8F155458D
Migration 20180329185634 failed during Execution. Error An exception occurred while executing ‘ALTER TABLE ma_lead_event_log DROP FOREIGN KEY FK_3364E8F155458D’:
SQLSTATE[42000]: Syntax error or access violation: 1091 Can’t DROP ‘FK_3364E8F155458D’; check that column/key exists
[Doctrine\DBAL\Exception\DriverException]
An exception occurred while executing ‘ALTER TABLE ma_lead_event_log
DROP FOREIGN KEY FK_3364E8F155458D’:
SQLSTATE[42000]: Syntax error or access violation: 1091 Can’t DROP ’
FK_3364E8F155458D’; check that column/key exists
[Doctrine\DBAL\Driver\PDOException]
SQLSTATE[42000]: Syntax error or access violation: 1091 Can’t DROP ’
FK_3364E8F155458D’; check that column/key exists
[PDOException]
SQLSTATE[42000]: Syntax error or access violation: 1091 Can’t DROP ’
FK_3364E8F155458D’; check that column/key exists
Steps I have tried to fix the problem: I’ve tried running the migration over manually and consistently get these errors. Is the lack of these foreign keys causing the migration to fail? Is there a command I can run to fix these missing foreign keys?