Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Trivial
-
Resolution: Won't Fix
-
Affects Version/s: 4.7
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Documentation Required?:None
-
Funding Source:Needs Funding
Description
I tried upgrading the database to 4.7.alpha3 but got a DB error
Error on rename of civicrm_action_schedule (errno: 152)
when dropping FK_civicrm_action_schedule_mapping_id
My understanding is that this error comes up mainly when the name of the foreign key is mis-spelled, or when it does not exist.
I am attaching the screenshot of the error and the create table statement for civicrm_action_schedule as it is in our DB.
Looking at /sql/civicrm.mysql, it does look as if our version of the table has a mere index where there should be a key and constraint. Perhaps the correct definition was lost during a DB import/export, or a previous conversion to MyISAM.
After rebuilding the foreign key, the update proceeded without error:
ALTER TABLE civicrm_action_schedule DROP KEY FK_civicrm_action_schedule_mapping_id;
ALTER TABLE `civicrm_action_schedule` ADD CONSTRAINT FK_civicrm_action_schedule_mapping_id FOREIGN KEY (`mapping_id`) REFERENCES `civicrm_action_mapping`(`id`) ON DELETE SET NULL;
I hope this helps someone.