You are here

function apachesolr_update_7007 in Apache Solr Search 8

Same name and namespace in other branches
  1. 7 apachesolr.install \apachesolr_update_7007()

Rename tables to make them more generic.

File

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

Code

function apachesolr_update_7007() {
  if (variable_get('apachesolr_update_from_6303', FALSE)) {
    return NULL;
  }
  db_drop_primary_key('apachesolr_server');
  db_drop_primary_key('apachesolr_server_variable');
  db_rename_table('apachesolr_server', 'apachesolr_environment');
  db_rename_table('apachesolr_server_variable', 'apachesolr_environment_variable');
  db_change_field('apachesolr_environment', 'server_id', 'env_id', array(
    'description' => 'Unique identifier for the environment',
    'type' => 'varchar',
    'length' => 64,
    'not null' => TRUE,
  ));
  db_change_field('apachesolr_environment_variable', 'server_id', 'env_id', array(
    'description' => 'Unique identifier for the environment',
    'type' => 'varchar',
    'length' => 64,
    'not null' => TRUE,
  ));
  db_add_primary_key('apachesolr_environment', array(
    'env_id',
  ));
  db_add_primary_key('apachesolr_environment_variable', array(
    'env_id',
    'name',
  ));
  $id = variable_get('apachesolr_default_server', NULL);
  if (isset($id)) {
    variable_set('apachesolr_default_environment', $id);
  }
  variable_del('apachesolr_default_server');
}