From 20d5377ee2a9090dfe9d1c9e82bcc8f5cebd68df Mon Sep 17 00:00:00 2001 From: eileen Date: Wed, 27 Jan 2016 21:38:10 +1300 Subject: [PATCH] CRM-17881 change index upgrade addition civicrm_financian_trxn.trxn_id to be upgrade friendly Also ref CRM-17752 --- CRM/Upgrade/Incremental/php/FourSeven.php | 14 ++++++++++++++ CRM/Upgrade/Incremental/sql/4.7.beta6.mysql.tpl | 6 +----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CRM/Upgrade/Incremental/php/FourSeven.php b/CRM/Upgrade/Incremental/php/FourSeven.php index c33b22201b..0d1dd5601f 100644 --- a/CRM/Upgrade/Incremental/php/FourSeven.php +++ b/CRM/Upgrade/Incremental/php/FourSeven.php @@ -142,6 +142,7 @@ class CRM_Upgrade_Incremental_php_FourSeven extends CRM_Upgrade_Incremental_Base public function upgrade_4_7_beta6($rev) { $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev); $this->addTask('Disable flexible jobs extension', 'disableFlexibleJobsExtension'); + $this->addTask('Add Index to financial_trxn trxn_id field', 'addIndexFinancialTrxnTrxnID'); } /** @@ -391,4 +392,17 @@ FROM `civicrm_dashboard_contact` WHERE 1 GROUP BY contact_id"; return TRUE; } + /** + * CRM-17752 add index to civicrm_financial_trxn.trxn_id (deliberately non-unique). + * + * @param \CRM_Queue_TaskContext $ctx + * + * @return bool + */ + public function addIndexFinancialTrxnTrxnID(CRM_Queue_TaskContext $ctx) { + $tables = array('civicrm_financial_trxn' => array('trxn_id')); + CRM_Core_BAO_SchemaHandler::createIndexes($tables); + return TRUE; + } + } diff --git a/CRM/Upgrade/Incremental/sql/4.7.beta6.mysql.tpl b/CRM/Upgrade/Incremental/sql/4.7.beta6.mysql.tpl index 8a2455de92..16ff252ea7 100644 --- a/CRM/Upgrade/Incremental/sql/4.7.beta6.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/4.7.beta6.mysql.tpl @@ -14,9 +14,5 @@ UPDATE civicrm_event SET max_additional_participants = 9 WHERE is_multiple_registrations = 1; --- CRM-17752 -ALTER TABLE `civicrm_financial_trxn` -ADD INDEX `UI_ftrxn_trxn_id` (`trxn_id`); - SELECT @domainID := min(id) FROM civicrm_domain; -INSERT INTO civicrm_setting(name, value, domain_id, is_domain) values ('installed', 'i:1;', @domainID, 1); \ No newline at end of file +INSERT INTO civicrm_setting(name, value, domain_id, is_domain) values ('installed', 'i:1;', @domainID, 1); -- 2.25.1