CRM-17882 Add index to civicrm_contribution.credit_note_id
authoreileen <emcnaughton@wikimedia.org>
Wed, 27 Jan 2016 18:58:00 +0000 (07:58 +1300)
committereileen <emcnaughton@wikimedia.org>
Wed, 27 Jan 2016 22:02:23 +0000 (11:02 +1300)
Change-Id: I5ad63820a3df93995ebd65ec76a8b3aac87ba1c6

CRM/Upgrade/Incremental/php/FourSeven.php
xml/schema/Contribute/Contribution.xml

index 0d1dd5601f6b02f53e9c609788ed1bd436c559ca..da42435c132bd65caba3ba2b90656b2ce398d06c 100644 (file)
@@ -145,6 +145,15 @@ class CRM_Upgrade_Incremental_php_FourSeven extends CRM_Upgrade_Incremental_Base
     $this->addTask('Add Index to financial_trxn trxn_id field', 'addIndexFinancialTrxnTrxnID');
   }
 
+  /**
+   * Upgrade function.
+   *
+   * @param string $rev
+   */
+  public function upgrade_4_7_1($rev) {
+    $this->addTask('Add Index to civicrm_contribution creditnote_id field', 'addIndexContributionCreditNoteID');
+  }
+
   /**
    * CRM-16354
    *
@@ -405,4 +414,17 @@ FROM `civicrm_dashboard_contact` WHERE 1 GROUP BY contact_id";
     return TRUE;
   }
 
+  /**
+   * CRM-17882 Add index to civicrm_contribution.credit_note_id.
+   *
+   * @param \CRM_Queue_TaskContext $ctx
+   *
+   * @return bool
+   */
+  public function addIndexContributionCreditNoteID(CRM_Queue_TaskContext $ctx) {
+    $tables = array('civicrm_contribution' => array('creditnote_id'));
+    CRM_Core_BAO_SchemaHandler::createIndexes($tables);
+    return TRUE;
+  }
+
 }
index db883c14e63fb91a3b05fd1e676ab48c3cb092c6..ea95a36ab7024e87a7e715265e9cf0de4b967de1 100644 (file)
       <type>Text</type>
     </html>
   </field>
+  <index>
+    <name>creditnote_id</name>
+    <fieldName>creditnote_id</fieldName>
+    <add>4.7</add>
+  </index>
   <field>
     <name>tax_amount</name>
     <title>Tax Amount</title>