You are here

function redirect_update_7101 in Redirect 7.2

Same name and namespace in other branches
  1. 7 redirect.install \redirect_update_7101()

Add status field.

File

./redirect.install, line 242
Install, update and uninstall functions for the redirect module.

Code

function redirect_update_7101() {
  $status_schema = array(
    'type' => 'int',
    'size' => 'small',
    'not null' => TRUE,
    'default' => 1,
    'description' => 'Boolean indicating whether the redirect is enabled (visible to non-administrators).',
  );
  if (!db_field_exists('redirect', 'status')) {
    db_add_field('redirect', 'status', $status_schema);
  }
  else {
    db_change_field('redirect', 'status', 'status', $status_schema);
  }
  if (db_index_exists('redirect', 'source_language')) {
    db_drop_index('redirect', 'source_language');
  }
  if (!db_index_exists('redirect', 'status_source_language')) {
    db_add_index('redirect', 'status_source_language', array(
      'status',
      'source',
      'language',
    ));
  }
}