Exemple #1
0
 /**
  * CRM-17775 Add correct index for table civicrm_financial_item.
  *
  * Note that the entity ID should always precede the entity_table as
  * it is more unique. This is better for performance and does not cause fallback
  * to no index if table it omitted.
  *
  * @return bool
  */
 public function addCombinedIndexFinancialItemEntityIDEntityType()
 {
     CRM_Core_BAO_SchemaHandler::dropIndexIfExists('civicrm_financial_item', 'UI_id');
     CRM_Core_BAO_SchemaHandler::dropIndexIfExists('civicrm_financial_item', 'IX_Entity');
     CRM_Core_BAO_SchemaHandler::createIndexes(array('civicrm_financial_item' => array(array('entity_id', 'entity_table'))));
     return TRUE;
 }
 /**
  * Test the drop index if exists function.
  */
 public function testDropIndexExists()
 {
     CRM_Core_BAO_SchemaHandler::dropIndexIfExists('civicrm_contact', 'index_hash');
     $this->assertFalse(CRM_Core_BAO_SchemaHandler::checkIfIndexExists('civicrm_contact', 'index_hash'));
     // Recreate it to clean up after the test.
     CRM_Core_BAO_SchemaHandler::createIndexes(array('civicrm_contact' => array('hash')));
 }
Exemple #3
0
 /**
  * CRM-19100 - Alter Index and Type for Image URL
  * @return bool
  */
 public static function alterIndexAndTypeForImageURL()
 {
     $length = array();
     CRM_Core_BAO_SchemaHandler::dropIndexIfExists('civicrm_contact', 'index_image_url');
     CRM_Core_DAO::executeQuery("ALTER TABLE `civicrm_contact` CHANGE `image_URL` `image_URL` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'optional URL for preferred image (photo, logo, etc.) to display for this contact.'");
     $length['civicrm_contact']['image_URL'] = 128;
     CRM_Core_BAO_SchemaHandler::createIndexes(array('civicrm_contact' => array('image_URL')), 'index', $length);
     return TRUE;
 }