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) »
  • Upgrading civicrm 1.9 to 2.0, FK constraint issue.
Pages: [1]

Author Topic: Upgrading civicrm 1.9 to 2.0, FK constraint issue.  (Read 722 times)

iandev

  • I’m new here
  • *
  • Posts: 16
  • Karma: 0
  • CiviCRM version: 4.1
  • CMS version: Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Upgrading civicrm 1.9 to 2.0, FK constraint issue.
May 10, 2012, 03:21:42 pm
I am working on a civi 1.9 install trying to upgrade to version 2.0, ultimately I want to upgrade to 4.1.  I followed the instructions for the 1.9=>2.0 upgrade and when running the upgrade script step 4, I get foreign key constraint errors.  Here is the exact error:

Sorry. A non-recoverable error has occurred.
Database Error Code: Cannot add or update a child row: a foreign key constraint fails (idfcrm_1dot9.civicrm_activity_target, CONSTRAINT FK_civicrm_activity_target_target_contact_id FOREIGN KEY (target_contact_id) REFERENCES civicrm_contact (id) ON DELETE CASCADE), 1452

I couldn't post the error dump directly in here, the forum complains about external links???
Here is a link to a google doc with the data dump.
docs.google.com/document/d/1sdRr4Mhuq1ZzyoVW_daTO5ceMq8QdNq6ZRBeYuEWqK0/edit


I tried searching the database to find the fk constraint issues and can't find anything.  I did find 1 where civicrm_activity.source_contact_id = 0, and there was no contact with an id of 0.  But I can't find any constraints related to the civicrm_activity_target table.

Any help with this is appreciated.
Thanks,
Ian Herbert
« Last Edit: May 10, 2012, 03:37:03 pm by iandev »

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Upgrading civicrm 1.9 to 2.0, FK constraint issue.
May 11, 2012, 06:43:00 am
That error means that the field target_contact_id must match the id of a contact. It sounds like you may have a lot of those set to zero then. Hard to say without seeing the DB. Perhaps a "kludge" solution would be to manually create a contact with an id of zero....
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • Upgrading civicrm 1.9 to 2.0, FK constraint issue.

This forum was archived on 2017-11-26.