Commit b59aa8f6 authored by Claudiu Cristea's avatar Claudiu Cristea Committed by Alejandro Garza
Browse files

Issue #2017705 by claudiu.cristea, mdupont, milesw: Performance! Add missed...

Issue #2017705 by claudiu.cristea, mdupont, milesw: Performance! Add missed indexes to {apachesolr_index_entities_file} table
parent 20d0d70b
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -116,6 +116,8 @@ function apachesolr_attachments_schema() {
      ),
      'indexes' => array(
        'changed' => array('changed', 'status'),
        'parent_entity_id' => array('parent_entity_id'),
        'parent_entity_type' => array('parent_entity_type'),
      ),
      'primary key' => array('entity_id', 'parent_entity_id', 'parent_entity_type'),
    );
@@ -294,3 +296,14 @@ function apachesolr_attachments_update_7005() {
    db_drop_field('apachesolr_index_entities_file', 'body');
  }
}

/**
 * Add database indexes for parent_entity_type and parent_entity_id.
 */
function apachesolr_attachments_update_7006() {
  foreach (array('parent_entity_id', 'parent_entity_type') as $field) {
    if (!db_index_exists('apachesolr_index_entities_file', $field)) {
      db_add_index('apachesolr_index_entities_file', $field, array($field));
    }
  }
}