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 »
  • Pre-installation Questions (Moderator: Dave Greenberg) »
  • Data Conversion - Dropping FK constraints in order to import records
Pages: [1]

Author Topic: Data Conversion - Dropping FK constraints in order to import records  (Read 1056 times)

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
Data Conversion - Dropping FK constraints in order to import records
July 17, 2011, 11:51:34 pm
Trying to convert historical event transactions by importing text files into civicrm_contribution, civicrm_participant & civicrm_participant_payment via PHPMYAdmin.  Hitting up against foreign key contraints on the contribution table and will probably have issues on the others.

Is it okay to drop the FK constraints on contribution table?  I notice that these fields are getting populated with NULL values via the front-end interface, i.e., when I key an event registration & payment on to a contact record manually, these FKs are not required and set to NULL.

Need to know if I drop these constraints and then reset them after the conversion is done if everything will be A-OKAY?
Annalee Van Kleeck
Lyric Systems, LLC
201 951.8711
annalee@lyricsystems.com

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: Data Conversion - Dropping FK constraints in order to import records
July 18, 2011, 11:51:00 am

personally i dont think its a good idea to drop FK constraints unlss u really really know what u r doing and know why the constraints are being violated and how/why they will be fixed when u turn them on

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

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: Data Conversion - Dropping FK constraints in order to import records
July 19, 2011, 07:51:46 pm
I agree with you and it's not my favorite modus operandi either but it might save me a day or two of work so I'd like to know what the consequences are.  Is there any documentation re: FK Constraints on the contribution and participant tables?  For example, I know that I am able to import contribution & participant records which are not linked to a contribution_page_id via the Import Interface and it sets the contribute_page_id value to null in the contribution table.  This is a FK constraint so I cannot import a NULL into this field and yet the system is obviously dropping this constraint in order to create the contribution record.

I also know that since I cannot link the contribution to the participant record via the interface, I imported the transaction id to both the contribute and the participant record and then created a text file with the contribute_id & participant_id and loaded the participant_payment table to create the link between the 2 records.  I've done this for 3 years worth of event history with no issues but it is extremely time-consuming and I'm out of time so I'm looking for a way to speed up the process.

Is there anyone out there who has run a conversion by dropping FK constraints and loading the tables directly via PHPMyAdmin?

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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Pre-installation Questions (Moderator: Dave Greenberg) »
  • Data Conversion - Dropping FK constraints in order to import records

This forum was archived on 2017-11-26.