Answers.Body: <p>Add the table</p>
  <pre><code> CREATE TABLE `civicrm_queue` (
    `id` int unsigned NOT NULL AUTO_INCREMENT,
    `name` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Name of the queue',
    `type` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Type of the queue',
    `runner` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Name of the task runner',
    `batch_limit` int unsigned NOT NULL DEFAULT '1' COMMENT 'Maximum number of items in a batch.',
    `lease_time` int unsigned NOT NULL DEFAULT '3600' COMMENT 'When claiming an item (or batch of items) for work, how long should the item(s) be reserved. (Seconds)',
    `retry_limit` int NOT NULL DEFAULT '0' COMMENT 'Number of permitted retries. Set to zero (0) to disable.',
    `retry_interval` int DEFAULT NULL COMMENT 'Number of seconds to wait before retrying a failed execution.',
    `status` varchar(16) COLLATE utf8mb4_unicode_ci DEFAULT 'active' COMMENT 'Execution status',
    `error` varchar(16) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Fallback behavior for unhandled errors',
    `is_template` tinyint NOT NULL DEFAULT '0' COMMENT 'Is this a template configuration (for use by other/future queues)?',
    PRIMARY KEY (`id`),
    UNIQUE KEY `UI_name` (`name`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-08-16T09:49:18.600Z
Answers.LastActivityDate: 2023-08-16T09:49:18.600Z
Answers.UserDisplayName: Pradeep Nayak
Answers.Body: <p>Your database has gotten out of sync with CiviCRM.  This may have happened if you had a failed upgrade, for instance.</p>
  <p>Pradeep's answer explained how to fix <code>civicrm_queue</code> but it may be more important to discover the underlying reason these tables are missing/incomplete.</p>
  <p>You can fix the most recent error with this SQL:</p>
  <pre><code>ALTER TABLE civicrm_queue_item ADD COLUMN run_count int NOT NULL DEFAULT 0 COMMENT 'Number of times execution has been attempted.';
  </code></pre>
  <p>This will add the missing &quot;run_count&quot; field, which should have been added on upgrade to Civi 5.48.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-08-25T20:35:27.327Z
Answers.LastActivityDate: 2023-08-25T20:35:27.327Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.Body: <p>The <code>civicrm_queue</code> table was introduced in 5.47 (see: <code>CRM/Upgrade/Incremental/sql/5.47.alpha1.mysql.tpl</code>).</p>
  <p>This error can happen when your skip several CiviCRM upgrade versions or your upgrade failed at some point. I had the similar error when jumping from 5.44.0 to 5.69.2 and upgrade process was failing as well.</p>
  <p>This table is required in newer versions while running upgrade (e.g. <code>cv ext:upgrade-db</code>). So ideally you should do upgrade of CiviCRM Core with small increments first to 5.47 (to create that table in the first place), then do further upgrades.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-01-15T22:49:11.453Z
Answers.LastActivityDate: 2024-01-15T22:49:11.453Z
Answers.UserDisplayName: kenorb
Body: <p>When opening extension manager I get a message that a database-upgrade is required for the extensions (Voor uw extensies is een database-upgrade nodig. Upgrade uitvoeren.) Running the upgrade results in an error: DB Error : no such table
  Suggestion was to tun the civicrm/upgrade?reset=1 (which I already executed after upgrading), but this now returns an error too: Database check returns an error</p>
  <p>From the log:</p>
  <p>core:</p>
  <blockquote>
  <p>$Fatal Error Details = array:3 [
  &quot;message&quot; =&gt; &quot;Database check geeft een fout, het lijkt er op dat de database deels geüpgraded is. Zet de back-up van de database terug en probeer opnieuw te upgraden.&quot;
  &quot;code&quot; =&gt; null
  &quot;exception&quot; =&gt; CRM_Core_Exception {#2069
  -errorData: array:1 [
  &quot;error_code&quot; =&gt; 0
  ]
  #cause: null
  -_trace: null
  #message: &quot;Database check geeft een fout, het lijkt er op dat de database deels geüpgraded is. Zet de back-up van de database terug en probeer opnieuw te upgraden.&quot;
  #code: 0
  #file: &quot;/data/sites/web/vendelennet/www/drupal7/sites/all/modules/civicrm/CRM/Upgrade/Form.php&quot;
  #line: 349
  trace: {
  /data/sites/web/vendelennet/www/drupal7/sites/all/modules/civicrm/CRM/Upgrade/Form.php:349 {
  › elseif (stripos($currentVer, 'upgrade')) {
  ›   throw new CRM_Core_Exception(ts('Database check failed - the database looks to have been partially upgraded. You may want to reload the database with the backup and try the upgrade process again.'));
  › }
  }</p>
  </blockquote>
  <p>extension:</p>
  <blockquote>
  <p>$Fatal Error Details = array:3 [
  &quot;message&quot; =&gt; &quot;DB Error: no such table&quot;
  &quot;code&quot; =&gt; null
  &quot;exception&quot; =&gt; PEAR_Exception {#1622
  #cause: DB_Error {#1608
  +error_message_prefix: &quot;&quot;
  +mode: 16
  +level: 1024
  +code: -18
  +message: &quot;DB Error: no such table&quot;
  +userinfo: &quot;UPDATE civicrm_queue SET status = NULL WHERE name = 'ext-upgrade' [nativecode=1146 ** Table 'ID291638_crm5vnet.civicrm_queue' doesn't exist]&quot;
  +backtrace: array:20 [
  0 =&gt; array:6 [
  &quot;file&quot; =&gt; &quot;/data/sites/web/vendelennet/www/drupal7/sites/all/modules/civicrm/vendor/pear/db/DB.php&quot;
  &quot;line&quot; =&gt; 997
  &quot;function&quot; =&gt; &quot;__construct&quot;
  &quot;class&quot; =&gt; &quot;PEAR_Error&quot;
  &quot;type&quot; =&gt; &quot;-&gt;&quot;
  &quot;args&quot; =&gt; array:5 [
  0 =&gt; &quot;DB Error: no such table&quot;
  1 =&gt; -18
  2 =&gt; 16
  3 =&gt; array:2 [
  0 =&gt; &quot;CRM_Core_Error&quot;
  1 =&gt; &quot;exceptionHandler&quot;
  ]
  4 =&gt; &quot;UPDATE civicrm_queue SET status = NULL WHERE name = 'ext-upgrade' [nativecode=1146 ** Table 'ID291638_crm5vnet.civicrm_queue' doesn't exist]&quot;
  ]
  ]
  1 =&gt; array:7 [
  &quot;file&quot; =&gt; &quot;/data/sites/web/vendelennet/www/drupal7/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php&quot;
  &quot;line&quot; =&gt; 575
  &quot;function&quot; =&gt; &quot;__construct&quot;
  &quot;class&quot; =&gt; &quot;DB_Error&quot;
  &quot;object&quot; =&gt; DB_Error {#1608}
  &quot;type&quot; =&gt; &quot;-&gt;&quot;
  &quot;args&quot; =&gt; array:4 [
  0 =&gt; -18
  1 =&gt; 16
  2 =&gt; array:2 [
  0 =&gt; &quot;CRM_Core_Error&quot;
  1 =&gt; &quot;exceptionHandler&quot;
  ]
  3 =&gt; &quot;UPDATE civicrm_queue SET status = NULL WHERE name = 'ext-upgrade' [nativecode=1146 ** Table 'ID291638_crm5vnet.civicrm_queue' doesn't exist]&quot;
  ]
  ]
  20230827-0021
  Not sure if I'm updating this case correctly</p>
  </blockquote>
  <p>Getting there one step at the time...
  Ran the SQL proposed by Jon, and now it is missing another table:</p>
  <p>Is there a way to find which update did not complete succesfully and how to fix all of it? I do not remember any update failing and I can access the information. CiviCRM is at version 5.60 and I want to have it at latest version before migrating the site to Drupal10.</p>
  <blockquote>
  <p>Aug 27 00:06:55  [info] $CRM_Queue_ErrorPolicy_reportException = PEAR_Exception: &quot;DB Error: no such table&quot;</p>
  <ul>
  <li>ERROR TYPE: DB_Error</li>
  <li>ERROR CODE: -18</li>
  <li>ERROR MESSAGE: DB Error: no such table</li>
  <li>ERROR MODE: 16</li>
  <li>ERROR USERINFO:
  SELECT uj.id FROM civicrm_queue q
  INNER JOIN civicrm_user_job uj ON q.id = uj.queue_id
  WHERE q.name = 'ext-upgrade'
  [nativecode=1146 ** Table 'ID291638_crm5vnet.civicrm_user_job' doesn't exist]</li>
  <li>ERROR DEBUGINFO:
  SELECT uj.id FROM civicrm_queue q
  INNER JOIN civicrm_user_job uj ON q.id = uj.queue_id
  WHERE q.name = 'ext-upgrade'
  [nativecode=1146 ** Table 'ID291638_crm5vnet.civicrm_user_job' doesn't exist]</li>
  </ul>
  </blockquote>
  <p>Running Drupal 7.98, CiviCRM 5.60.0, PHP 7.4</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-08-24T17:43:28.403Z
Comments.Text: Thanks Pradeep, I had to modify the command a little bit (syntax), but now the table civicrm_queue has been created (where civicrm_queue_item already existed and has 53 rows) I tried the upgrade again and now I get a 'no such field error' ```
  Aug 24 19:27:28 [info] $CRM_Queue_ErrorPolicy_reportException = PEAR_Exception: "DB Error: no such field" * ERROR TYPE: DB_Error * ERROR CODE: -19 * ERROR MESSAGE: DB Error: no such field * ERROR MODE: 16 * ERROR USERINFO: SELECT id, queue_name, submit_time, release_time, run_count, data FROM civicrm_queue_item WHERE queue_name = 'ext-upgrade' ORDER BY we
Comments.UserDisplayName: Stefaan H
Tags: <upgrade><extension>
Title: DB Error no such table civicrm_queue
ThreadText: # DB Error no such table civicrm_queue
  
  (Asked by: username_0 on 2023-08-16)
  
  When opening extension manager I get a message that a database-upgrade is required for the extensions (Voor uw extensies is een database-upgrade nodig. Upgrade uitvoeren.) Running the upgrade results in an error: DB Error : no such table
  Suggestion was to tun the civicrm/upgrade?reset=1 (which I already executed after upgrading), but this now returns an error too: Database check returns an error
  
  From the log:
  
  core:
  
  > $Fatal Error Details = array:3 [
  > "message" => "Database check geeft een fout, het lijkt er op dat de database deels geüpgraded is. Zet de back-up van de database terug en probeer opnieuw te upgraden."
  > "code" => null
  > "exception" => CRM\_Core\_Exception {#2069
  > -errorData: array:1 [
  > "error\_code" => 0
  > ]
  > #cause: null
  > -\_trace: null
  > #message: "Database check geeft een fout, het lijkt er op dat de database deels geüpgraded is. Zet de back-up van de database terug en probeer opnieuw te upgraden."
  > #code: 0
  > #file: "/data/sites/web/vendelennet/www/drupal7/sites/all/modules/civicrm/CRM/Upgrade/Form.php"
  > #line: 349
  > trace: {
  > /data/sites/web/vendelennet/www/drupal7/sites/all/modules/civicrm/CRM/Upgrade/Form.php:349 {
  > › elseif (stripos($currentVer, 'upgrade')) {
  > › throw new CRM\_Core\_Exception(ts('Database check failed - the database looks to have been partially upgraded. You may want to reload the database with the backup and try the upgrade process again.'));
  > › }
  > }
  
  extension:
  
  > $Fatal Error Details = array:3 [
  > "message" => "DB Error: no such table"
  > "code" => null
  > "exception" => PEAR\_Exception {#1622
  > #cause: DB\_Error {#1608
  > +error\_message\_prefix: ""
  > +mode: 16
  > +level: 1024
  > +code: -18
  > +message: "DB Error: no such table"
  > +userinfo: "UPDATE civicrm\_queue SET status = NULL WHERE name = 'ext-upgrade' [nativecode=1146 \*\* Table 'ID291638\_crm5vnet.civicrm\_queue' doesn't exist]"
  > +backtrace: array:20 [
  > 0 => array:6 [
  > "file" => "/data/sites/web/vendelennet/www/drupal7/sites/all/modules/civicrm/vendor/pear/db/DB.php"
  > "line" => 997
  > "function" => "\_\_construct"
  > "class" => "PEAR\_Error"
  > "type" => "->"
  > "args" => array:5 [
  > 0 => "DB Error: no such table"
  > 1 => -18
  > 2 => 16
  > 3 => array:2 [
  > 0 => "CRM\_Core\_Error"
  > 1 => "exceptionHandler"
  > ]
  > 4 => "UPDATE civicrm\_queue SET status = NULL WHERE name = 'ext-upgrade' [nativecode=1146 \*\* Table 'ID291638\_crm5vnet.civicrm\_queue' doesn't exist]"
  > ]
  > ]
  > 1 => array:7 [
  > "file" => "/data/sites/web/vendelennet/www/drupal7/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php"
  > "line" => 575
  > "function" => "\_\_construct"
  > "class" => "DB\_Error"
  > "object" => DB\_Error {#1608}
  > "type" => "->"
  > "args" => array:4 [
  > 0 => -18
  > 1 => 16
  > 2 => array:2 [
  > 0 => "CRM\_Core\_Error"
  > 1 => "exceptionHandler"
  > ]
  > 3 => "UPDATE civicrm\_queue SET status = NULL WHERE name = 'ext-upgrade' [nativecode=1146 \*\* Table 'ID291638\_crm5vnet.civicrm\_queue' doesn't exist]"
  > ]
  > ]
  > 20230827-0021
  > Not sure if I'm updating this case correctly
  
  Getting there one step at the time...
  Ran the SQL proposed by Jon, and now it is missing another table:
  
  Is there a way to find which update did not complete succesfully and how to fix all of it? I do not remember any update failing and I can access the information. CiviCRM is at version 5.60 and I want to have it at latest version before migrating the site to Drupal10.
  
  > Aug 27 00:06:55 [info] $CRM\_Queue\_ErrorPolicy\_reportException = PEAR\_Exception: "DB Error: no such table"
  >
  > * ERROR TYPE: DB\_Error
  > * ERROR CODE: -18
  > * ERROR MESSAGE: DB Error: no such table
  > * ERROR MODE: 16
  > * ERROR USERINFO:
  >   SELECT uj.id FROM civicrm\_queue q
  >   INNER JOIN civicrm\_user\_job uj ON q.id = uj.queue\_id
  >   WHERE q.name = 'ext-upgrade'
  >   [nativecode=1146 \*\* Table 'ID291638\_crm5vnet.civicrm\_user\_job' doesn't exist]
  > * ERROR DEBUGINFO:
  >   SELECT uj.id FROM civicrm\_queue q
  >   INNER JOIN civicrm\_user\_job uj ON q.id = uj.queue\_id
  >   WHERE q.name = 'ext-upgrade'
  >   [nativecode=1146 \*\* Table 'ID291638\_crm5vnet.civicrm\_user\_job' doesn't exist]
  
  Running Drupal 7.98, CiviCRM 5.60.0, PHP 7.4
  
  **Tags:** upgrade, extension
  
  > **Comments:**
  > **username_0**: Thanks Pradeep, I had to modify the command a little bit (syntax), but now the table civicrm_queue has been created (where civicrm_queue_item already existed and has 53 rows) I tried the upgrade again and now I get a 'no such field error' ``` Aug 24 19:27:28 [info] $CRM_Queue_ErrorPolicy_reportException = PEAR_Exception: "DB Error: no such field" * ERROR TYPE: DB_Error * ERROR CODE: -19 * ERROR MESSAGE: DB Error: no such field * ERROR MODE: 16 * ERROR USERINFO: SELECT id, queue_name, submit_time, release_time, run_count, data FROM civicrm_queue_item WHERE queue_name = 'ext-upgrade' ORDER BY we  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2023-08-16. Score: 3
  
  Add the table
   CREATE TABLE `civicrm_queue` (
    `id` int unsigned NOT NULL AUTO_INCREMENT,
    `name` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Name of the queue',
    `type` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Type of the queue',
    `runner` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Name of the task runner',
    `batch_limit` int unsigned NOT NULL DEFAULT '1' COMMENT 'Maximum number of items in a batch.',
    `lease_time` int unsigned NOT NULL DEFAULT '3600' COMMENT 'When claiming an item (or batch of items) for work, how long should the item(s) be reserved. (Seconds)',
    `retry_limit` int NOT NULL DEFAULT '0' COMMENT 'Number of permitted retries. Set to zero (0) to disable.',
    `retry_interval` int DEFAULT NULL COMMENT 'Number of seconds to wait before retrying a failed execution.',
    `status` varchar(16) COLLATE utf8mb4_unicode_ci DEFAULT 'active' COMMENT 'Execution status',
    `error` varchar(16) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Fallback behavior for unhandled errors',
    `is_template` tinyint NOT NULL DEFAULT '0' COMMENT 'Is this a template configuration (for use by other/future queues)?',
    PRIMARY KEY (`id`),
    UNIQUE KEY `UI_name` (`name`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
  
  
  ---
  
  ### Answer by username_2 on 2023-08-25. Score: 2
  
  Your database has gotten out of sync with CiviCRM.  This may have happened if you had a failed upgrade, for instance.
  Pradeep's answer explained how to fix civicrm_queue but it may be more important to discover the underlying reason these tables are missing/incomplete.
  You can fix the most recent error with this SQL:
  ALTER TABLE civicrm_queue_item ADD COLUMN run_count int NOT NULL DEFAULT 0 COMMENT 'Number of times execution has been attempted.';
  
  This will add the missing "run_count" field, which should have been added on upgrade to Civi 5.48.
  
  
  ---
  
  ### Answer by username_3 on 2024-01-15. Score: 1
  
  The `civicrm_queue` table was introduced in 5.47 (see: `CRM/Upgrade/Incremental/sql/5.47.alpha1.mysql.tpl`).
  
  This error can happen when your skip several CiviCRM upgrade versions or your upgrade failed at some point. I had the similar error when jumping from 5.44.0 to 5.69.2 and upgrade process was failing as well.
  
  This table is required in newer versions while running upgrade (e.g. `cv ext:upgrade-db`). So ideally you should do upgrade of CiviCRM Core with small increments first to 5.47 (to create that table in the first place), then do further upgrades.
  
  
  ---
  
  