CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • Error reconfiguring event
Pages: [1]

Author Topic: Error reconfiguring event  (Read 1309 times)

sdybiec

  • Guest
Error reconfiguring event
June 10, 2008, 05:33:46 am
After creating an event in CiviEvent, we decided not to have email addresses listed on our event listing. When we attempted to remove the email addresses using the "Event Location and Contact Information" page, we got this error:



Code: [Select]
Sorry. A non-recoverable error has occurred.

Database Error Code: Cannot delete or update a parent row: a foreign key constraint fails (`uaprogre_civicrm19Fix/civicrm_loc_block`, CONSTRAINT `FK_civicrm_loc_block_email_id` FOREIGN KEY (`email_id`) REFERENCES `civicrm_email` (`id`)), 1451

Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -1
    [message] => DB Error: unknown error
    [mode] => 16
    [debug_info] => DELETE FROM civicrm_email  WHERE (  civicrm_email.id = 2086 )  [nativecode=1451 ** Cannot delete or update a parent row: a foreign key constraint fails (`uaprogre_civicrm19Fix/civicrm_loc_block`, CONSTRAINT `FK_civicrm_loc_block_email_id` FOREIGN KEY (`email_id`) REFERENCES `civicrm_email` (`id`))]
    [type] => DB_Error
    [user_info] => DELETE FROM civicrm_email  WHERE (  civicrm_email.id = 2086 )  [nativecode=1451 ** Cannot delete or update a parent row: a foreign key constraint fails (`uaprogre_civicrm19Fix/civicrm_loc_block`, CONSTRAINT `FK_civicrm_loc_block_email_id` FOREIGN KEY (`email_id`) REFERENCES `civicrm_email` (`id`))]
    [to_string] => [db_error: message="DB Error: unknown error" code=-1 mode=callback callback=CRM_Core_Error::handle prefix="" info="DELETE FROM civicrm_email  WHERE (  civicrm_email.id = 2086 )  [nativecode=1451 ** Cannot delete or update a parent row: a foreign key constraint fails (`uaprogre_civicrm19Fix/civicrm_loc_block`, CONSTRAINT `FK_civicrm_loc_block_email_id` FOREIGN KEY (`email_id`) REFERENCES `civicrm_email` (`id`))]"]

Our site is upgraded from a 1.9 site.

What do you make of this and how can I fix this?

$cott[/code]
« Last Edit: June 10, 2008, 05:45:58 am by sdybiec »

Deepak Srivastava

  • Moderator
  • Ask me questions
  • *****
  • Posts: 677
  • Karma: 65
Re: Error reconfiguring event
July 01, 2008, 02:08:39 am
Here is the fix, if you haven't got it - run the following query on your civicrm db -

Code: [Select]
ALTER TABLE `civicrm_loc_block`
DROP FOREIGN KEY `FK_civicrm_loc_block_email_id`,
DROP FOREIGN KEY `FK_civicrm_loc_block_email_2_id`,
DROP FOREIGN KEY `FK_civicrm_loc_block_phone_id`,
DROP FOREIGN KEY  `FK_civicrm_loc_block_phone_2_id`,
DROP FOREIGN KEY `FK_civicrm_loc_block_im_id`,
DROP FOREIGN KEY  `FK_civicrm_loc_block_im_2_id`;

ALTER TABLE `civicrm_loc_block`
ADD CONSTRAINT `FK_civicrm_loc_block_email_id` FOREIGN KEY (`email_id`) REFERENCES `civicrm_email` (`id`) ON DELETE SET NULL,
ADD CONSTRAINT `FK_civicrm_loc_block_email_2_id` FOREIGN KEY (`email_2_id`) REFERENCES `civicrm_email` (`id`) ON DELETE SET NULL,
ADD CONSTRAINT `FK_civicrm_loc_block_phone_id` FOREIGN KEY (`phone_id`) REFERENCES `civicrm_phone` (`id`) ON DELETE SET NULL,
ADD CONSTRAINT `FK_civicrm_loc_block_phone_2_id` FOREIGN KEY (`phone_2_id`) REFERENCES `civicrm_phone` (`id`) ON DELETE SET NULL,
ADD CONSTRAINT `FK_civicrm_loc_block_im_id` FOREIGN KEY (`im_id`) REFERENCES `civicrm_im` (`id`) ON DELETE SET NULL,
ADD CONSTRAINT `FK_civicrm_loc_block_im_2_id` FOREIGN KEY (`im_2_id`) REFERENCES `civicrm_im` (`id`) ON DELETE SET NULL;

This basically sets the "ON DELETE SET NULL" constraint which i suspect wasn't done by upgrade.
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • Error reconfiguring event

This forum was archived on 2017-11-26.