Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-489

Foreign key contstraint issues in SQL

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.2
    • Fix Version/s: None
    • Labels:
      None

      Description

      When trying to rebuild the CiviCRM tables for the latest version:
      sql $ mysql civicspace_082 -uxxxx -pyyyyy < civicrm_41.mysql
      Enter password:
      ERROR 1217 (23000) at line 71: Cannot delete or update a parent row: a foreign key constraint fails

      I got round this by manually deleting the tables.

      Next problem: When civicrm_sample.mysql is run:

      sql $ mysql civicspace_082 -uroot -p < civicrm_sample.mysql
      Enter password:
      ERROR 1216 (23000) at line 3: Cannot add or update a child row: a foreign key constraint fails

      This is fixed by adding:
      SET FOREIGN_KEY_CHECKS = 0;
      at the top of civicrm_sample.mysql, and at the bottom:
      SET FOREIGN_KEY_CHECKS = 1;

      (Running MySql 4.1.11 on Mandriva 10.2)

        Attachments

          Activity

            People

            • Assignee:
              lobo Donald A. Lobo
              Reporter:
              krabi Peter Cruickshank
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: