Answers.Body: <p>I can also confirm this error occurs on Wordpress CMS.</p>
  <p>It stuck at: <code>[Executed: Add column civicrm_custom_field.fk_entity]</code></p>
  <p><strong>SOLUTION</strong>:</p>
  <p>After restoring the CiviCRM database from the backup, I did the following:</p>
  <ol>
  <li>Removed all records from <code>civicrm_job_log</code> table by command:</li>
  </ol>
  <p><code>DELETE FROM civicrm_job_log;</code></p>
  <ol start="2">
  <li>Re-run the update process from CiviCRM main window, and it finished successfully.</li>
  </ol>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-04-20T16:14:06.883Z
Answers.Text: 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"
Answers.UserDisplayName: kapn
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-04-21T05:47:21.343Z
Answers.Text: @kapn Sorry about that. Edited.
Answers.UserDisplayName: Nick Kondratiev
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-05-09T19:38:36.320Z
Answers.Text: Your solution worked. Thank you very much!
Answers.UserDisplayName: Guitarman
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-04-18T10:45:13.163Z
Answers.LastActivityDate: 2023-04-21T05:44:39.127Z
Answers.LastEditDate: 2023-04-21T05:44:39.127Z
Answers.UserDisplayName: Nick Kondratiev
Answers.Body: <p>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:</p>
  <p>Hi All,</p>
  <p>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]</p>
  <p>DB Error: constraint violation</p>
  <p>Debug info: ALTER TABLE civicrm_job_log          ADD CONSTRAINT FK_civicrm_job_log_job_id FOREIGN KEY ( <code>job_id</code> ) REFERENCES civicrm_job ( id )  ON DELETE SET NULL [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (<code>bitnami_civicrm</code>.<code>#sql-alter-1820-61d</code>, CONSTRAINT <code>FK_civicrm_job_log_job_id</code> FOREIGN KEY (<code>job_id</code>) REFERENCES <code>civicrm_job</code> (<code>id</code>) ON DELETE SET NULL)]</p>
  <p>I have only found 1 solution on google about this issue, and it didn't seem to work, heres the link to that: <a href="https://civicrm.stackexchange.com/questions/44762/civicrm-upgrade-to-5-60-civicrm-job-log-foreign-key-constraint">CiviCRM Upgrade to 5.60, civicrm_job_log foreign key constraint</a></p>
  <p>I was hoping someone here might have any other ideas?</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-04-20T12:50:59.250Z
Answers.Text: The error you have is a different error than the original poster so should be on a different question.
Answers.UserDisplayName: Demerit
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-04-19T06:53:33.167Z
Answers.LastActivityDate: 2023-04-19T06:53:33.167Z
Answers.UserDisplayName: Des Quinn
Body: <p>After upgrade to 5.60.0 , I got an error when updating the database :</p>
  <p>Error: Add foreign key from civicrm_job_log to civicrm_job</p>
  <p>ALTER TABLE civicrm_job_log ADD CONSTRAINT FK_civicrm_job_log_job_id FOREIGN KEY ( <code>job_id</code> ) 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 &quot;Unknown (generic) error from engine&quot;)</p>
  <p>PEAR_Exception: DB Error: unknown error in /xxxxx/administrator/components/com_civicrm/civicrm/packages/PEAR.php on line 921</p>
  <ul>
  <li>DB_Error: DB Error: unknown error in unknown on line unknown</li>
  </ul>
  <p>The site is in Joomla 3.10.11
  I tried to restore the DB, and relaunch DB upgrade, but same error.</p>
  <p>Any idea how I can solve this issue ?</p>
  <p>Antoine</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-04-16T02:32:19.053Z
Comments.Text: 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.
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-05-26T15:17:26.563Z
Comments.Text: See https://civicrm.stackexchange.com/q/44762/225
Comments.UserDisplayName: Aidan
Tags: <upgrade><joomla>
Title: DB update failure after update 5.60
ThreadText: # DB update failure after update 5.60
  
  (Asked by: username_0 on 2023-04-15)
  
  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 ?
  
  username_0
  
  **Tags:** upgrade, joomla
  
  > **Comments:**
  > **username_1**: 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.  
  > **username_2**: See https://civicrm.stackexchange.com/q/44762/225  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_3 on 2023-04-18. Score: 3
  
  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;`
  
  2. Re-run the update process from CiviCRM main window, and it finished successfully.
  
  > **Comments:**
  > **username_4**: 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"  
  > **username_3**: @username_4 Sorry about that. Edited.  
  > **username_5**: Your solution worked. Thank you very much!  
  
  ---
  
  ### Answer by username_6 on 2023-04-19. Score: 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](https://civicrm.stackexchange.com/questions/44762/civicrm-upgrade-to-5-60-civicrm-job-log-foreign-key-constraint)
  
  I was hoping someone here might have any other ideas?
  
  > **Comments:**
  > **username_1**: The error you have is a different error than the original poster so should be on a different question.  
  
  ---
  
  