I'm running civicrm 4.4.20 on the latest Joomla 3.4.5. When I try to enable CiviCase I get an database constraint error (see below).

[code] => -3
    [message] => DB Error: constraint violation
    [mode] => 16
    [debug_info] => 
        `option_group_id`, `label`, `value`, `name`,
        `grouping`, `filter`, `is_default`, `weight`,
        `description`, `is_optgroup`, `is_reserved`, `is_active`
      ) (
          @option_group_id_case_type, 'Housing Support', @max_val + 1, 'housing_support', 
          NULL, 0, 0, @max_wt + 1, 
          'Help homeless individuals obtain temporary and long-term housing', 0, 0, 1
         FROM   DUAL
         WHERE  NOT EXISTS (SELECT command.plist infoShowed
                            FROM   `CIVICRM_OPTION_VALUE`
                            WHERE  `name` = 'housing_support')
    [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`xxx_joomla`.`civicrm_option_value`, CONSTRAINT `FK_civicrm_option_value_option_group_id` FOREIGN KEY (`option_group_id`) REFERENCES `civicrm_option_group` (`id`) ON DELETE CASCADE)]
    [type] => DB_Error
  • Apparently when you enable civicase sample data is inserted. For some reason its failing on my install. The foreign key set up seems ok. It almost seems like the install is inserting into option_value before it inserts into option_group? – Jay Nov 16 '15 at 17:28

Resolved. I found the code that was inserting the sample data. It was first pulling from option_group where name=case_type. For some reason my database did not have this row - so the subsequent line inserting into option_value with the retrieved id of the option_group row failed.

I manually inserted a row into option_group with name of case_type. (I used "Case Type" for both title and description and set the is_active column and is_reserved column to 1 and is_locked to 0.

This got rid of the error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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