Ejegg has submitted this change and it was merged. Change subject: Add index to creditnote_id field to mitigate speed issue on doing refunds ......................................................................
Add index to creditnote_id field to mitigate speed issue on doing refunds I had previously improved the query but it's still taking 7 seconds due to the missing index I've also added in the index on financial_item.trxn_id which I had previous added to 4.7. These have been added to core in an 'upgrade friendly way', meaning adding them now won't cause us to hit problems when we later upgrade to 4.7. https://issues.civicrm.org/jira/browse/CRM-17881 https://issues.civicrm.org/jira/browse/CRM-17882 Bug: T123305 Change-Id: If9a8a1c7360bc8a42bf2d3517abbd5ce3499f5f7 --- M sites/all/modules/wmf_civicrm/wmf_civicrm.install 1 file changed, 24 insertions(+), 0 deletions(-) Approvals: Ejegg: Looks good to me, approved jenkins-bot: Verified diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.install b/sites/all/modules/wmf_civicrm/wmf_civicrm.install index 3180053..4e3a7d8 100644 --- a/sites/all/modules/wmf_civicrm/wmf_civicrm.install +++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.install @@ -44,6 +44,7 @@ wmf_civicrm_update_7062(); wmf_civicrm_update_7063(); wmf_civicrm_update_7064(); + wmf_civicrm_update_7080(); } /** @@ -1627,3 +1628,26 @@ civicrm_api3('OptionValue', 'delete', array('id' => $expectedRedundantType['id'])); civicrm_api3('OptionValue', 'create', array('id' => $options['values'][0]['id'], 'is_reserved' => TRUE)); } + +/** + * Add indexes that are missing from CiviCRM 4.6. + * + * These indexes have been added to 4.7 using the same php function. + * + * This function checks the index does not already exist before adding it. + * This ensures that we will not hit a problem on upgrade as a result of adding them now. + * + * Note this could be a slow update. + * + * https://github.com/civicrm/civicrm-core/pull/7672 + * https://github.com/civicrm/civicrm-core/pull/7678 + * https://github.com/civicrm/civicrm-core/pull/7673 + */ +function wmf_civicrm_update_7080() { + civicrm_initialize(); + $tables = array('civicrm_contribution' => array('creditnote_id')); + CRM_Core_BAO_SchemaHandler::createIndexes($tables); + + $tables = array('civicrm_financial_trxn' => array('trxn_id')); + CRM_Core_BAO_SchemaHandler::createIndexes($tables); +} -- To view, visit https://gerrit.wikimedia.org/r/268051 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: If9a8a1c7360bc8a42bf2d3517abbd5ce3499f5f7 Gerrit-PatchSet: 1 Gerrit-Project: wikimedia/fundraising/crm Gerrit-Branch: master Gerrit-Owner: Eileen <[email protected]> Gerrit-Reviewer: Awight <[email protected]> Gerrit-Reviewer: Cdentinger <[email protected]> Gerrit-Reviewer: Ejegg <[email protected]> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
