1

Help! I just upgraded Civi from 4.7.3 to 4.7.7, but my host timed out during the DB upgrade and it was unable to complete. So I restored a backup of the database and was going to try again, but now every time I do anything with Civi, it gives me a DB Error: constraint violation.

I can't access any of Civi's backend now; it all gives me the same error. And when I try to run the upgrade script, it gives me the error after I click upgrade.

Is there anything I can do? Is my entire Database and my backup worthless now??

1
  • 1
    Begin by looking at the CiviCRM log files (wiki.civicrm.org/confluence/display/CRMDOC/…). That should provide a clue regarding the nature of the constraint violation. It may be something you can fix manually and then proceed with the upgrade. May 17, 2016 at 18:11

1 Answer 1

1

Strange, we had an issue on 4.6.24 just now.

The CiviCRM log file stated: -

DB Error: constraint violation

The debug information should give you the MySQL table name. For some reason, a custom table (civicrm_value_tablename_id) was linked by foreign key (entity_id) to the wrong table. In my case, it was the civicrm_event table, whereas it should have been to the civicrm_participant table.

My solution was to truncate (empty) the civicrm_value_tablename_id table, remove the incorrect foreign key, then add the correct foreign key.

Strange though that I had to do this manually as the CiviCRM custom data set screen showed that the Custom Data set in question is 'Used for' (or extends Participants).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.