1

After upgrade to 5.60.0 , I got an error when updating the database :

Error: Add foreign key from civicrm_job_log to civicrm_job

ALTER TABLE civicrm_job_log ADD CONSTRAINT FK_civicrm_job_log_job_id FOREIGN KEY ( job_id ) REFERENCES civicrm_job ( id ) ON DELETE SET NULL [nativecode=1025 ** Error on rename of './xxxxxxxx/civicrm_job_log' to './xxxxxxxx/#sql-backup-32ca-2de3f' (errno: 168 "Unknown (generic) error from engine")

PEAR_Exception: DB Error: unknown error in /xxxxx/administrator/components/com_civicrm/civicrm/packages/PEAR.php on line 921

  • DB_Error: DB Error: unknown error in unknown on line unknown

The site is in Joomla 3.10.11 I tried to restore the DB, and relaunch DB upgrade, but same error.

Any idea how I can solve this issue ?

Antoine

2
  • The internet suggests this error is usually not the real error - try running SHOW ENGINE INNODB STATUS and looking for the real error in the output.
    – Demerit
    Apr 16 at 2:32
  • See civicrm.stackexchange.com/q/44762/225
    – Aidan
    May 26 at 15:17

2 Answers 2

2

I can also confirm this error occurs on Wordpress CMS.

It stuck at: [Executed: Add column civicrm_custom_field.fk_entity]

SOLUTION:

After restoring the CiviCRM database from the backup, I did the following:

  1. Removed all records from civicrm_job_log table by command:

DELETE FROM civicrm_job_log;

  1. Re-run the update process from CiviCRM main window, and it finished successfully.
3
  • This looks like it should be part of the question rather than an answer. Please consider putting this information in an edit to the original question and deleting this "answer"
    – kapn
    Apr 20 at 16:14
  • 1
    @kapn Sorry about that. Edited. Apr 21 at 5:47
  • Your solution worked. Thank you very much!
    – Guitarman
    May 9 at 19:38
0

We have seen the same error on Drupal 7.x and PHP 7.4. Holding at 5.59 for the timebeing. This is from our post on mattermost:

Hi All,

I'm trying to update to Civi 5.60 from 5.59.4, however once i perform the database upgrades for 5.60 it shows an error near the end with this message: [Error: Add foreign key from civicrm_job_log to civicrm_job]

DB Error: constraint violation

Debug info: ALTER TABLE civicrm_job_log ADD CONSTRAINT FK_civicrm_job_log_job_id FOREIGN KEY ( job_id ) REFERENCES civicrm_job ( id ) ON DELETE SET NULL [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (bitnami_civicrm.#sql-alter-1820-61d, CONSTRAINT FK_civicrm_job_log_job_id FOREIGN KEY (job_id) REFERENCES civicrm_job (id) ON DELETE SET NULL)]

I have only found 1 solution on google about this issue, and it didn't seem to work, heres the link to that: CiviCRM Upgrade to 5.60, civicrm_job_log foreign key constraint

I was hoping someone here might have any other ideas?

1
  • 1
    The error you have is a different error than the original poster so should be on a different question.
    – Demerit
    Apr 20 at 12:50

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.