Answers.Body: <p>As confirmed in <a href="https://chat.civicrm.org/civicrm/pl/8ek6gxgdzibrzx95p9shf4c3he" rel="nofollow noreferrer">chat</a> the views hadn't been created and disabling and reenabling civicase at Administer - System Settings - Components fixed it.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-16T17:48:48.310Z
Answers.Text: Thank you for the help!
Answers.UserDisplayName: David W
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-16T14:07:02.370Z
Answers.LastActivityDate: 2020-05-16T14:07:02.370Z
Answers.UserDisplayName: Demerit
Body: <p>I have a Drupal 7 + CiviCRM database with CiviCase.
  This is a fairly new install. I would say CiviCRM was installed fresh about 3-4 months ago. As of now, CiviCRM has been upgraded to the latest current version, 5.25.0.</p>
  
  <p>I noticed the following problem on 5.24, but as this is still a new install in development, its possible the problem has been there since the beginning. </p>
  
  <p>When I go to Cases -> Dashboard, I see:</p>
  
  <blockquote>
    <p>DB Error: no such table</p>
  </blockquote>
  
  <p>Additionally, when I go to view a Contact, and then click the "Cases" tab, I see the follow message in the upper right of the screen:</p>
  
  <blockquote>
    <p>Unable to reach the server. Please refresh this page in your browser
    and try again.</p>
  </blockquote>
  
  <p>How should I go about fixing this?
  It seems like the entire table structure is missing?</p>
  
  <p>There is no production data in the CiviCase extension yet, so if it is possible to just do a complete fresh install of just that portion of CiviCRM, I can do that. I just don't know how I would do that safely without affecting the work I've done to other portions of the Drupal and CiviCRM database.</p>
  
  <p>Here is the backtrace for when I see the DB error:</p>
  
  <pre><code>#9 /home/lapavnhy/example.com/sites/all/modules/civicrm/packages/DB/DataObject.php(2696): DB_common-&gt;query(" SELECT COUNT(*) FROM (SELECT civicrm_case.id as case_id, civicrm_case.subjec...")#10 /home/lapavnhy/example.com/sites/all/modules/civicrm/packages/DB/DataObject.php(1829): DB_DataObject-&gt;_query(" SELECT COUNT(*) FROM (SELECT civicrm_case.id as case_id, civicrm_case.subjec...")
  #11 /home/lapavnhy/example.com/sites/all/modules/civicrm/CRM/Core/DAO.php(421): DB_DataObject-&gt;query(" SELECT COUNT(*) FROM (SELECT civicrm_case.id as case_id, civicrm_case.subjec...")
  #12 /home/lapavnhy/example.com/sites/all/modules/civicrm/CRM/Core/DAO.php(1540): CRM_Core_DAO-&gt;query(" SELECT COUNT(*) FROM (SELECT civicrm_case.id as case_id, civicrm_case.subjec...", TRUE)#13 /home/lapavnhy/example.com/sites/all/modules/civicrm/CRM/Case/BAO/Case.php(537): CRM_Core_DAO::singleValueQuery(" SELECT COUNT(*) FROM (SELECT civicrm_case.id as case_id, civicrm_case.subjec...")
  #14 /home/lapavnhy/example.com/sites/all/modules/civicrm/CRM/Case/Page/DashBoard.php(71): CRM_Case_BAO_Case::getCases(NULL, (Array:0), "dashboard", TRUE)
  #15 /home/lapavnhy/example.com/sites/all/modules/civicrm/CRM/Case/Page/DashBoard.php(100): CRM_Case_Page_DashBoard-&gt;preProcess()
  #16 /home/lapavnhy/example.com/sites/all/modules/civicrm/CRM/Core/Invoke.php(311): CRM_Case_Page_DashBoard-&gt;run((Array:2), NULL)
  #17 /home/lapavnhy/example.com/sites/all/modules/civicrm/CRM/Core/Invoke.php(68): CRM_Core_Invoke::runItem((Array:15))
  #18 /home/lapavnhy/example.com/sites/all/modules/civicrm/CRM/Core/Invoke.php(36): CRM_Core_Invoke::_invoke((Array:2))
  #19 /home/lapavnhy/example.com/sites/all/modules/civicrm/drupal/civicrm.module(454): CRM_Core_Invoke::invoke((Array:2))
  #20 /home/lapavnhy/example.com/includes/menu.inc(527): civicrm_invoke("case")
  #21 /home/lapavnhy/example.com/index.php(21): menu_execute_active_handler()
  #22 {main}
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-15T11:12:50.307Z
Comments.Text: can you also provide the sql statment?
Comments.UserDisplayName: Pradeep Nayak
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-15T12:11:21.953Z
Comments.Text: Does the mysql user have create view permission? It sounds like maybe the db views didn't get created? e.g  
   `civicrm_view_case_activity_upcoming`   https://github.com/civicrm/civicrm-core/blob/5.25.0/CRM/Case/BAO/Case.php#L2829. Try disabling then reenabling civicase at admin - system settings - components.
Comments.UserDisplayName: Demerit
Tags: <civicase><database>
Title: 'DB Error - No Such Table' -- CiviCase in Drupal 7
ThreadText: # 'DB Error - No Such Table' -- CiviCase in Drupal 7
  
  (Asked by: username_0 on 2020-05-15)
  
  I have a Drupal 7 + CiviCRM database with CiviCase.
  This is a fairly new install. I would say CiviCRM was installed fresh about 3-4 months ago. As of now, CiviCRM has been upgraded to the latest current version, 5.25.0.
  I noticed the following problem on 5.24, but as this is still a new install in development, its possible the problem has been there since the beginning. 
  When I go to Cases -> Dashboard, I see:
  
  DB Error: no such table
  
  Additionally, when I go to view a Contact, and then click the "Cases" tab, I see the follow message in the upper right of the screen:
  
  Unable to reach the server. Please refresh this page in your browser
    and try again.
  
  How should I go about fixing this?
  It seems like the entire table structure is missing?
  There is no production data in the CiviCase extension yet, so if it is possible to just do a complete fresh install of just that portion of CiviCRM, I can do that. I just don't know how I would do that safely without affecting the work I've done to other portions of the Drupal and CiviCRM database.
  Here is the backtrace for when I see the DB error:
  #9 /home/lapavnhy/example.com/sites/all/modules/civicrm/packages/DB/DataObject.php(2696): DB_common->query(" SELECT COUNT(*) FROM (SELECT civicrm_case.id as case_id, civicrm_case.subjec...")#10 /home/lapavnhy/example.com/sites/all/modules/civicrm/packages/DB/DataObject.php(1829): DB_DataObject->_query(" SELECT COUNT(*) FROM (SELECT civicrm_case.id as case_id, civicrm_case.subjec...")
  #11 /home/lapavnhy/example.com/sites/all/modules/civicrm/CRM/Core/DAO.php(421): DB_DataObject->query(" SELECT COUNT(*) FROM (SELECT civicrm_case.id as case_id, civicrm_case.subjec...")
  #12 /home/lapavnhy/example.com/sites/all/modules/civicrm/CRM/Core/DAO.php(1540): CRM_Core_DAO->query(" SELECT COUNT(*) FROM (SELECT civicrm_case.id as case_id, civicrm_case.subjec...", TRUE)#13 /home/lapavnhy/example.com/sites/all/modules/civicrm/CRM/Case/BAO/Case.php(537): CRM_Core_DAO::singleValueQuery(" SELECT COUNT(*) FROM (SELECT civicrm_case.id as case_id, civicrm_case.subjec...")
  #14 /home/lapavnhy/example.com/sites/all/modules/civicrm/CRM/Case/Page/DashBoard.php(71): CRM_Case_BAO_Case::getCases(NULL, (Array:0), "dashboard", TRUE)
  #15 /home/lapavnhy/example.com/sites/all/modules/civicrm/CRM/Case/Page/DashBoard.php(100): CRM_Case_Page_DashBoard->preProcess()
  #16 /home/lapavnhy/example.com/sites/all/modules/civicrm/CRM/Core/Invoke.php(311): CRM_Case_Page_DashBoard->run((Array:2), NULL)
  #17 /home/lapavnhy/example.com/sites/all/modules/civicrm/CRM/Core/Invoke.php(68): CRM_Core_Invoke::runItem((Array:15))
  #18 /home/lapavnhy/example.com/sites/all/modules/civicrm/CRM/Core/Invoke.php(36): CRM_Core_Invoke::_invoke((Array:2))
  #19 /home/lapavnhy/example.com/sites/all/modules/civicrm/drupal/civicrm.module(454): CRM_Core_Invoke::invoke((Array:2))
  #20 /home/lapavnhy/example.com/includes/menu.inc(527): civicrm_invoke("case")
  #21 /home/lapavnhy/example.com/index.php(21): menu_execute_active_handler()
  #22 {main}
  
  **Tags:** civicase, database
  
  > **Comments:**
  > **username_1**: can you also provide the sql statment?  
  > **username_2**: Does the mysql user have create view permission? It sounds like maybe the db views didn't get created? e.g    `civicrm_view_case_activity_upcoming`   https://github.com/civicrm/civicrm-core/blob/5.25.0/CRM/Case/BAO/Case.php#L2829. Try disabling then reenabling civicase at admin - system settings - components.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2020-05-16. Score: 1 | Accepted answer
  
  As confirmed in [chat](https://chat.civicrm.org/civicrm/pl/8ek6gxgdzibrzx95p9shf4c3he) the views hadn't been created and disabling and reenabling civicase at Administer - System Settings - Components fixed it.
  
  > **Comments:**
  > **username_0**: Thank you for the help!  
  
  ---
  
  