0

DB error when upgrading Civi from 5.60.0 to 5.67.0

Type    DB_Error
Code    -3
Message DB Error: constraint violation
Mode    16
UserInfo    ALTER TABLE `civicrm_activity` ADD CONSTRAINT `FK_civicrm_activity_parent_id` FOREIGN KEY (`parent_id`) REFERENCES `civicrm_activity` (`id`) ON DELETE SET NULL [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`d9_civicrm`.`#sql-48a_21833f`, CONSTRAINT `FK_civicrm_activity_parent_id` FOREIGN KEY (`parent_id`) REFERENCES `civicrm_activity` (`id`) ON DELETE SET NULL)]
DebugInfo   ALTER TABLE `civicrm_activity` ADD CONSTRAINT `FK_civicrm_activity_parent_id` FOREIGN KEY (`parent_id`) REFERENCES `civicrm_activity` (`id`) ON DELETE SET NULL [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`d9_civicrm`.`#sql-48a_21833f`, CONSTRAINT `FK_civicrm_activity_parent_id` FOREIGN KEY (`parent_id`) REFERENCES `civicrm_activity` (`id`) ON DELETE SET NULL)]

1 Answer 1

3

Looks like civicrm_activity.parent_id is pointing to orphan records. You will need to fix the orphan records and then run the upgrade. You can use MySQL commands to fix the records.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.