When I upload a fresh delete.csv file - one column of bounced emails for a clean-up process - and then try to mautic:import via SSH as ‘username’ (not root), I get the following error message:
Import 92 with 45 rows is starting.
0/45 [>---------------------------] 0%
In AbstractMySQLDriver.php line 68:
An exception occurred while executing 'INSERT INTO lead_event_log (user
_id, user_name, bundle, object, action, object_id, date_added, properties,
lead_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)' with params [1, "My Name", "lead", "import", "updated", 92, "2022-08-29 15:39:05", "{\"line\":3,
\"file\":\"DELETE.csv\"}", "9670"]:
SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update
a child row: a foreign key constraint fails (`username_mautic`.`lead_event_log`, CONSTRAINT `FK_78B7E97955458D` FOREIGN KEY (`lead_id`) REFERENCES
`leads` (`id`) ON DELETE CASCADE)
In Exception.php line 18:
SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update
a child row: a foreign key constraint fails (`username_mautic`.`lead_event_log`, CONSTRAINT `FK_78B7E97955458D` FOREIGN KEY (`lead_id`) REFERENCES
`leads` (`id`) ON DELETE CASCADE)
In PDOStatement.php line 117:
SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update
a child row: a foreign key constraint fails (`username_mautic`.`lead_event_log`, CONSTRAINT `FK_78B7E97955458D` FOREIGN KEY (`lead_id`) REFERENCES
`leads` (`id`) ON DELETE CASCADE)
mautic:import [-i|--id [ID]] [-l|--limit [LIMIT]] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command>
I’ve run into ‘foreign key constraint fails’ in other places, probably the same issue. Does anyone know what this relates to?
What is FK_78B7E97955458D?
What is the role of lead_event_log in importing contacts data via csv?
Is there a way to reset that table or whatever is causing these hang-ups?
What is involved in the import process; what should I check?
What does VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
mean - looks bad…?
How can I solve ‘an integrity violation that seems to point to a foreign key that does not exist in the database’?
I’m at a dead end here. Any suggestions or best guesses how to troubleshoot this would be very much appreciated.