You are here

function apachesolr_update_7013 in Apache Solr Search 7

Same name and namespace in other branches
  1. 8 apachesolr.install \apachesolr_update_7013()

Make consistent (and reduce) field lengths which cause excess pkey length.

File

./apachesolr.install, line 824
Install and related hooks for apachesolr_search.

Code

function apachesolr_update_7013() {
  if (variable_get('apachesolr_update_from_6303', FALSE)) {
    return NULL;
  }
  db_drop_primary_key('apachesolr_index_entities');
  db_change_field('apachesolr_index_entities', 'entity_type', 'entity_type', array(
    'description' => 'The type of entity.',
    'type' => 'varchar',
    'length' => 32,
    'not null' => TRUE,
  ));
  db_add_primary_key('apachesolr_index_entities', array(
    'entity_id',
    'entity_type',
  ));
  db_change_field('apachesolr_index_entities_node', 'entity_type', 'entity_type', array(
    'description' => 'The type of entity.',
    'type' => 'varchar',
    'length' => 32,
    'not null' => TRUE,
  ));
  db_drop_primary_key('apachesolr_index_bundles');
  db_change_field('apachesolr_index_bundles', 'env_id', 'env_id', array(
    'description' => 'Unique identifier for the environment',
    'type' => 'varchar',
    'length' => 64,
    'not null' => TRUE,
  ));
  db_change_field('apachesolr_index_bundles', 'entity_type', 'entity_type', array(
    'description' => 'The type of entity.',
    'type' => 'varchar',
    'length' => 32,
    'not null' => TRUE,
  ));
  db_add_primary_key('apachesolr_index_bundles', array(
    'env_id',
    'entity_type',
    'bundle',
  ));
}