Skip to content
Snippets Groups Projects
Commit b676923b authored by Pradeep Nayak's avatar Pradeep Nayak
Browse files

--fixed for CRM-12141

parent 095467d8
Branches
No related tags found
No related merge requests found
......@@ -139,6 +139,9 @@ WHERE entity_value = '' OR entity_value IS NULL
function upgrade_4_3_alpha1($rev) {
self::task_4_3_alpha1_checkDBConstraints();
// add indexes for civicrm_entity_financial_trxn
// CRM-12141
$this->addTask(ts('Check/Add indexes for civicrm_entity_financial_trxn'), 'task_4_3_x_checkIndexes', $rev);
// task to process sql
$this->addTask(ts('Upgrade DB to 4.3.alpha1: SQL'), 'task_4_3_x_runSql', $rev);
......@@ -206,6 +209,9 @@ WHERE entity_value = '' OR entity_value IS NULL
function upgrade_4_3_beta4($rev) {
$this->addTask(ts('Upgrade DB to 4.3.beta4: SQL'), 'task_4_3_x_runSql', $rev);
// add indexes for civicrm_entity_financial_trxn
// CRM-12141
$this->addTask(ts('Check/Add indexes for civicrm_entity_financial_trxn'), 'task_4_3_x_checkIndexes', $rev);
}
//CRM-11636
......@@ -348,6 +354,9 @@ FROM civicrm_entity_financial_account ceft
INNER JOIN civicrm_option_group cog ON cog.id = cov.option_group_id
WHERE cog.name = 'payment_instrument'";
CRM_Core_DAO::executeQuery($sql);
//CRM-12141
$sql = "ALTER TABLE {$tempTableName1} ADD INDEX index_instrument_id (instrument_id);";
CRM_Core_DAO::executeQuery($sql);
//create temp table to process completed / cancelled contribution
$tempTableName2 = CRM_Core_DAO::createTempTableName();
......@@ -379,6 +388,9 @@ FROM civicrm_contribution con
ON con.payment_instrument_id = tpi.instrument_id
WHERE con.contribution_status_id IN ({$completedStatus}, {$cancelledStatus})";
CRM_Core_DAO::executeQuery($sql);
// CRM-12141
$sql = "ALTER TABLE {$tempTableName2} ADD INDEX index_action (action);";
CRM_Core_DAO::executeQuery($sql);
//handling for completed contribution and cancelled contribution
//insertion of new records
......@@ -771,6 +783,23 @@ AND TABLE_SCHEMA = '{$dbUf['database']}'";
return TRUE;
}
/**
* Check/Add INDEX CRM-12141
*
* @return bool TRUE for success
*/
function task_4_3_x_checkIndexes(CRM_Queue_TaskContext $ctx) {
$query = "SHOW KEYS FROM `civicrm_entity_financial_trxn`
WHERE key_name IN ('UI_entity_financial_trxn_entity_table', 'UI_entity_financial_trxn_entity_id');";
$dao = CRM_Core_DAO::executeQuery($query);
if (!$dao->N) {
CRM_Core_DAO::executeQuery("ALTER TABLE civicrm_entity_financial_trxn
ADD INDEX UI_entity_financial_trxn_entity_table (entity_table),
ADD INDEX UI_entity_financial_trxn_entity_id (entity_id);");
}
return TRUE;
}
/**
* Update phones CRM-11292
*
......
......@@ -62,5 +62,15 @@
<add>3.2</add>
<drop>4.3</drop>
</field>
<index>
<name>UI_entity_financial_trxn_entity_table</name>
<fieldName>entity_table</fieldName>
<add>4.3</add>
</index>
<index>
<name>UI_entity_financial_trxn_entity_id</name>
<fieldName>entity_id</fieldName>
<add>4.3</add>
</index>
</table>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment