You are here

function nodewords_update_6169 in Nodewords: D6 Meta Tags 6

Same name and namespace in other branches
  1. 6.2 nodewords.install \nodewords_update_6169()

Implements hook_update_N().

File

./nodewords.install, line 1380
Installation file for nodewords.module.

Code

function nodewords_update_6169() {
  $ret = array();
  if (!db_column_exists('nodewords_custom', 'weight')) {
    db_add_field($ret, 'nodewords_custom', 'weight', array(
      'type' => 'int',
      'size' => 'small',
      'not null' => TRUE,
      'default' => 0,
    ));
  }
  else {
    db_change_field($ret, 'nodewords_custom', 'weight', 'weight', array(
      'type' => 'int',
      'size' => 'small',
      'not null' => TRUE,
      'default' => 0,
    ));
  }
  if (!db_column_exists('nodewords_custom', 'enabled')) {
    db_add_field($ret, 'nodewords_custom', 'enabled', array(
      'type' => 'int',
      'size' => 'small',
      'unsigned' => TRUE,
      'not null' => TRUE,
      'default' => 1,
    ));
  }
  else {
    db_change_field($ret, 'nodewords_custom', 'enabled', 'enabled', array(
      'type' => 'int',
      'size' => 'small',
      'unsigned' => TRUE,
      'not null' => TRUE,
      'default' => 1,
    ));
  }
  if (!db_column_exists('nodewords', 'type')) {
    db_add_field($ret, 'nodewords', 'type', array(
      'type' => 'int',
      'size' => 'small',
      'unsigned' => TRUE,
      'not null' => TRUE,
      'default' => 0,
    ));
    db_add_index($ret, 'nodewords', 'nodewords_type_id', array(
      'type',
      'id',
    ));
    db_add_unique_key($ret, 'nodewords', 'nodewords_type_id_name', array(
      'type',
      'id',
      'name',
    ));
  }
  else {
    db_drop_index($ret, 'nodewords', 'nodewords_type_id');
    db_drop_unique_key($ret, 'nodewords', 'nodewords_type_id_name');
    db_change_field($ret, 'nodewords', 'type', 'type', array(
      'type' => 'int',
      'size' => 'small',
      'unsigned' => TRUE,
      'not null' => TRUE,
      'default' => 0,
    ));
    db_add_index($ret, 'nodewords', 'nodewords_type_id', array(
      'type',
      'id',
    ));
    db_add_unique_key($ret, 'nodewords', 'nodewords_type_id_name', array(
      'type',
      'id',
      'name',
    ));
  }
  return $ret;
}