Your software
My Mautic version is: 2.16
My PHP version is: 7.3
Your problem
My problem is: Schema Update Fails + Campaign Errors
These errors are showing in the log:
[Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException]
An exception occurred while executing ‘ALTER TABLE mauhu_lead_companies_change_log ADD CONSTRAINT FK_47567A9455458D FOREIGN KEY (lead_id) REFERENCES mauhu_leads (id) ON DELETE CASCADE’:
Cannot add or update a child row: a foreign key constraint fails (admin_maut806
.#sql-85e_f4d
, CONSTRAINT FK_47567A9455458D
FOREIGN KEY (lead_id
) REFERENCES mauhu_leads
(id
) ON DELETE CASCADE)
[Doctrine\DBAL\Driver\Mysqli\MysqliException]
Cannot add or update a child row: a foreign key constraint fails (admin_maut806
.#sql-85e_f4d
, CONSTRAINT FK_47567A9455458D
FOREIGN KEY (lead_id
) REFERENCES mauhu_leads
(id
) ON DELETE CASCADE)
AND*****************************************************************************
[2020-02-26 18:51:56] mautic.NOTICE: Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException: An exception occurred while executing ‘ALTER TABLE mauhu_lead_companies_change_log ADD CONSTRAINT FK_47567A9455458D FOREIGN KEY (lead_id) REFERENCES mauhu_leads (id) ON DELETE CASCADE’: Cannot add or update a child row: a foreign key constraint fails (admin_maut806
.#sql-85e_f19
, CONSTRAINT FK_47567A9455458D
FOREIGN KEY (lead_id
) REFERENCES mauhu_leads
(id
) ON DELETE CASCADE) (uncaught exception) at Mautic_Install/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 60 while running console command doctrine:schema:update
[2020-02-26 18:58:24] mautic.NOTICE: Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException: An exception occurred while executing ‘ALTER TABLE mauhu_lead_companies_change_log ADD CONSTRAINT FK_47567A9455458D FOREIGN KEY (lead_id) REFERENCES mauhu_leads (id) ON DELETE CASCADE’: Cannot add or update a child row: a foreign key constraint fails (admin_maut806
.#sql-85e_f4d
, CONSTRAINT FK_47567A9455458D
FOREIGN KEY (lead_id
) REFERENCES mauhu_leads
(id
) ON DELETE CASCADE) (uncaught exception) at Mautic-Install/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 60 while running console command doctrine:schema:update
AND*****************************************************************************
[2020-02-26 19:00:02] mautic.ERROR: CAMPAIGN: An exception occurred while executing ‘REPLACE INTO mauhu_campaign_lead_event_failed_log( log_id
, date_added
, reason
) SELECT id, :dateAdded as date_added, :message as reason from mauhu_campaign_lead_event_log WHERE is_scheduled = 1 AND lead_id = :contactId AND campaign_id = :campaignId AND rotation = :rotation’: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ':dateAdded as date_added, :message as reason from mauhu_campaign_lead_event_log ’ at line 2
AND*********************************************************************************
*doctrine:schema:validate
[Mapping] FAIL - The entity-class ‘Mautic\DynamicContentBundle\Entity\DynamicContentLeadData’ mapping is invalid:
- The association Mautic\DynamicContentBundle\Entity\DynamicContentLeadData#dynamicContent refers to the inverse side field Mautic\DynamicContentBundle\Entity\DynamicContent#id which is not defined as association.
- The association Mautic\DynamicContentBundle\Entity\DynamicContentLeadData#dynamicContent refers to the inverse side field Mautic\DynamicContentBundle\Entity\DynamicContent#id which does not exist.
[Mapping] FAIL - The entity-class ‘Bazinga\OAuthServerBundle\Model\AccessToken’ mapping is invalid:
- The field ‘Bazinga\OAuthServerBundle\Model\AccessToken#expiresAt’ uses a non-existant type ‘int’.
[Mapping] FAIL - The entity-class ‘Bazinga\OAuthServerBundle\Model\RequestToken’ mapping is invalid:
- The field ‘Bazinga\OAuthServerBundle\Model\RequestToken#expiresAt’ uses a non-existant type ‘int’.
[Database] FAIL - The database schema is not in sync with the current mapping file.
AND****************************************************************************************************
SQL DUMP
Steps I have tried to fix the problem: Followed these steps
https://johnlinhart.com/blog/uh-oh-mautic-upgrade-was-not-successful
https://www.mautic.org/docs/en/tips/update-failed.html