Details

    • Type: Sub-task
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 4.6.22, 4.7.10, 4.7.15, 4.7.23
    • Fix Version/s: None
    • Component/s: Core CiviCRM
    • Labels:
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding
    • Verified?:
      No
    • How it should work:
      CiviCRM should detect the index already exists and modify it
    • Acceptance Criteria:
      CiviCRM doesn't fail when you select "Fix missing Indexes" because of this issue.

      Description

      The new "Fix missing indexes" functionality introduced in CRM-20372 and available in CiviCRM 4.7.20 has failed on every upgrade I have done! Every time because the index UI_case_contact_id on civicrm_case_contact already exists but is not set as "UNIQUE". It can be resolved manually by editing the index in the database directly.

      Backtrace:
      Jul 05 16:43:37 [info] $Fatal Error Details = Array
      (
      {{{{ [callback] => Array}}}}
      {{{{ (}}}}
      {{{{ [0] => CRM_Core_Error}}}}
      {{{{ [1] => exceptionHandler}}}}
      {{{{ )}}[code] => -5}}
      {{{{ [message] => DB Error: already exists}}}}
      {{{{ [mode] => 16}}}}
      {{{{ [debug_info] => CREATE UNIQUE INDEX UI_case_contact_id ON civicrm_case_contact (case_id, contact_id) [nativecode=1061 ** Duplicate key name 'UI_case_contact_id']}}}}
      {{{{ [type] => DB_Error}}}}
      {{{{ [user_info] => CREATE UNIQUE INDEX UI_case_contact_id ON civicrm_case_contact (case_id, contact_id) [nativecode=1061 ** Duplicate key name 'UI_case_contact_id']}}}}
      {{{{ [to_string] => [db_error: message="DB Error: already exists" code=-5 mode=callback callback=CRM_Core_Error::exceptionHandler prefix="" info="CREATE UNIQUE INDEX UI_case_contact_id ON civicrm_case_contact (case_id, contact_id) [nativecode=1061 ** Duplicate key name 'UI_case_contact_id']"]}}}}
      )
      Jul 05 16:43:37 [info] $backTrace = #0 /var/www/drupal/sites/all/modules/civicrm/CRM/Core/Error.php(944): CRM_Core_Error::backtrace("backTrace", TRUE)
      #1 [internal function](): CRM_Core_Error::exceptionHandler(Object(DB_Error))
      #2 /var/www/drupal/sites/all/modules/civicrm/packages/PEAR.php(921): call_user_func((Array:2), Object(DB_Error))
      #3 /var/www/drupal/sites/all/modules/civicrm/packages/DB.php(985): PEAR_Error->__construct("DB Error: already exists", -5, 16, (Array:2), "CREATE UNIQUE INDEX UI_case_contact_id ON civicrm_case_contact (case_id, cont...")
      #4 /var/www/drupal/sites/all/modules/civicrm/packages/PEAR.php(575): DB_Error->__construct(-5, 16, (Array:2), "CREATE UNIQUE INDEX UI_case_contact_id ON civicrm_case_contact (case_id, cont...")
      #5 [internal function](): PEAR->_raiseError(Object(DB_mysqli), NULL, -5, NULL, NULL, "CREATE UNIQUE INDEX UI_case_contact_id ON civicrm_case_contact (case_id, cont...", "DB_Error", TRUE)
      #6 /var/www/drupal/sites/all/modules/civicrm/packages/PEAR.php(224): call_user_func_array((Array:2), (Array:8))
      #7 /var/www/drupal/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->__call("raiseError", (Array:7))
      #8 /var/www/drupal/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -5, NULL, NULL, "CREATE UNIQUE INDEX UI_case_contact_id ON civicrm_case_contact (case_id, cont...", "DB_Error", TRUE)
      #9 /var/www/drupal/sites/all/modules/civicrm/packages/DB/mysqli.php(933): DB_common->raiseError(-5, NULL, NULL, NULL, "1061 ** Duplicate key name 'UI_case_contact_id'")
      #10 /var/www/drupal/sites/all/modules/civicrm/packages/DB/mysqli.php(403): DB_mysqli->mysqliRaiseError()
      #11 /var/www/drupal/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysqli->simpleQuery("CREATE UNIQUE INDEX UI_case_contact_id ON civicrm_case_contact (case_id, cont...")
      #12 /var/www/drupal/sites/all/modules/civicrm/packages/DB/DataObject.php(2446): DB_common->query("CREATE UNIQUE INDEX UI_case_contact_id ON civicrm_case_contact (case_id, cont...")
      #13 /var/www/drupal/sites/all/modules/civicrm/packages/DB/DataObject.php(1635): DB_DataObject->_query("CREATE UNIQUE INDEX UI_case_contact_id ON civicrm_case_contact (case_id, cont...")
      #14 /var/www/drupal/sites/all/modules/civicrm/CRM/Core/DAO.php(362): DB_DataObject->query("CREATE UNIQUE INDEX UI_case_contact_id ON civicrm_case_contact (case_id, cont...")
      #15 /var/www/drupal/sites/all/modules/civicrm/CRM/Core/BAO/SchemaHandler.php(760): CRM_Core_DAO->query("CREATE UNIQUE INDEX UI_case_contact_id ON civicrm_case_contact (case_id, cont...", FALSE)
      #16 /var/www/drupal/sites/all/modules/civicrm/api/v3/System.php(411): CRM_Core_BAO_SchemaHandler::createMissingIndices((Array:5))
      #17 /var/www/drupal/sites/all/modules/civicrm/Civi/API/Provider/MagicFunctionProvider.php(89): civicrm_api3_system_updateindexes((Array:2))
      #18 /var/www/drupal/sites/all/modules/civicrm/Civi/API/Kernel.php(169): Civi\API\Provider\MagicFunctionProvider->invoke((Array:9))
      #19 /var/www/drupal/sites/all/modules/civicrm/Civi/API/Kernel.php(100): Civi\API\Kernel->runRequest((Array:7))
      #20 /var/www/drupal/sites/all/modules/civicrm/api/api.php(23): Civi\API\Kernel->runSafe("System", "updateindexes", (Array:2), NULL)
      #21 /var/www/drupal/sites/all/modules/civicrm/CRM/Utils/REST.php(404): civicrm_api("System", "updateindexes", (Array:2))
      #22 /var/www/drupal/sites/all/modules/civicrm/CRM/Utils/REST.php(661): CRM_Utils_REST::process((Array:3), (Array:0))
      #23 /var/www/drupal/sites/all/modules/civicrm/CRM/Utils/REST.php(638): CRM_Utils_REST::processMultiple()
      #24 [internal function](): CRM_Utils_REST::ajax()
      #25 /var/www/drupal/sites/all/modules/civicrm/CRM/Core/Invoke.php(276): call_user_func((Array:2))
      #26 /var/www/drupal/sites/all/modules/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:12))
      #27 /var/www/drupal/sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3))
      #28 /var/www/drupal/sites/all/modules/civicrm/drupal/civicrm.module(448): CRM_Core_Invoke::invoke((Array:3))
      #29 [internal function](): civicrm_invoke("ajax", "rest")
      #30 /var/www/drupal/includes/menu.inc(527): call_user_func_array("civicrm_invoke", (Array:2))
      #31 /var/www/drupal/index.php(21): menu_execute_active_handler()
      #32 {main}

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mattwire Matthew Wire
            • Votes:
              3 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

              • Created:
                Updated: