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) »
  • Foreign Key Constraints Prevent Upgrade 3.0.2 to 3.1.4
Pages: [1]

Author Topic: Foreign Key Constraints Prevent Upgrade 3.0.2 to 3.1.4  (Read 2039 times)

DaisyK

  • Guest
Foreign Key Constraints Prevent Upgrade 3.0.2 to 3.1.4
April 22, 2010, 12:25:49 pm
About 100 contacts (looks like the sample data) are missing.
#1452 - Cannot add or update a child row: a foreign key constraint fails (`daisyorg_civicrm2/civicrm_activity`, CONSTRAINT `FK_civicrm_activity_source_contact_id` FOREIGN KEY (`source_contact_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE SET NULL)

Will send 3.0.2 database per Kurund.

annaleevk

  • I post occasionally
  • **
  • Posts: 87
  • Karma: 3
  • Carpe Noctem!
    • Women in Development, New York
  • CiviCRM version: 3.4.5
  • CMS version: Drupal 6.22
  • MySQL version: 5.1.48
  • PHP version: 5.2.14
Re: Foreign Key Constraints Prevent Upgrade 3.0.2 to 3.1.4
May 10, 2010, 07:13:55 am
I am having similar foreign key constraint issues from 3.0.2 to 3.1.4.  Full detail of error message is attached.

Database Error Code: Cannot add or update a child row: a foreign key constraint fails (`handson_devcivicrm/#sql-6d6_88e048`, CONSTRAINT `FK_civicrm_pcp_block_supporter_profile_id` FOREIGN KEY (`supporter_profile_id`) REFERENCES `civicrm_uf_group` (`id`) ON DELETE SET NULL), 1452

Any help would be most appreciated.  I'm trying to upgrade a test version of the site at devtest.handson.org.

Thanks,
Annalee
Annalee Van Kleeck
Lyric Systems, LLC
201 951.8711
annalee@lyricsystems.com

Deepak Srivastava

  • Moderator
  • Ask me questions
  • *****
  • Posts: 677
  • Karma: 65
Re: Foreign Key Constraints Prevent Upgrade 3.0.2 to 3.1.4
May 10, 2010, 09:13:49 am
As per upgrade doc - http://wiki.civicrm.org/confluence/display/CRMDOC/Upgrade+Drupal+Sites+to+3.1#UpgradeDrupalSitesto3.1-ForeignKeyErrorsorWarningsDuringtheDatabaseUpgrade

following http://wiki.civicrm.org/confluence/display/CRMDOC/Ensuring+Schema+Integrity+on+Upgrades will make sure that you don't get fk errors.
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

petienne

  • Guest
Re: Foreign Key Constraints Prevent Upgrade 3.0.2 to 3.1.4
May 17, 2010, 10:47:06 am
Sorry, but what can you do if you have already done the upgrade (to 3.14) but you didn't use the approved technique and you are still getting the foreign key constraint fails errors?

Kindly,
Paul

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Foreign Key Constraints Prevent Upgrade 3.0.2 to 3.1.4
May 17, 2010, 01:20:38 pm

basically u'll need to track and fix each FK error till you are all sorted out. Typically its a just a few objects which cause most of these errors

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: Foreign Key Constraints Prevent Upgrade 3.0.2 to 3.1.4
May 21, 2010, 04:46:53 pm
I've found it's best not to skip versions or 'jump ahead' when upgrading.  On a couple of occasions this has been a cure for my FK errors.  One time I upgraded all the way from 2.2.3 to 3.1.5 one version at a time.   :)

Another time I found success by exporting and reimporting into a fresh, correct schema.  This is particularly effective on older sites from the 2.1 era.  Kurund taught me that one.
Try CiviTeacher: the online video tutorial CiviCRM learning library.

rchapman

  • I post occasionally
  • **
  • Posts: 77
  • Karma: 0
Re: Foreign Key Constraints Prevent Upgrade 3.0.2 to 3.1.4
June 18, 2010, 10:19:59 am
Hi Stoob,

  I'm currently using civi 3.1alpha2 and trying to get up to 3.1.4 stable. When you upgraded one at a time, did you include all the betas in between, or go straight to the closest stable version then from there?

~r

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: Foreign Key Constraints Prevent Upgrade 3.0.2 to 3.1.4
June 24, 2010, 05:42:50 pm
I did not include betas, but only because I avoid installing beta software in general. I go from stable release to stable release.

In your case I would upgrade from alpha to the last beta, and from the beta to the first stable.
Try CiviTeacher: the online video tutorial CiviCRM learning library.

rchapman

  • I post occasionally
  • **
  • Posts: 77
  • Karma: 0
Re: Foreign Key Constraints Prevent Upgrade 3.0.2 to 3.1.4
June 25, 2010, 08:41:31 am
Sage advice, Stoob. Thanks for the reply. :)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • Foreign Key Constraints Prevent Upgrade 3.0.2 to 3.1.4

This forum was archived on 2017-11-26.