You are here

function nodeviewcount_update_7211 in Node view count 7.3

Same name and namespace in other branches
  1. 7 nodeviewcount.install \nodeviewcount_update_7211()
  2. 7.2 nodeviewcount.install \nodeviewcount_update_7211()

Add a new nid index in DB to the table nodeviewcount.

File

./nodeviewcount.install, line 83
Creates table for views counting.

Code

function nodeviewcount_update_7211() {
  $table = 'nodeviewcount';
  $index_name = 'nid';
  if (db_table_exists($table)) {
    if (!db_index_exists($table, $index_name)) {
      db_add_index($table, $index_name, array(
        'nid',
      ));
      return t('New index added');
    }
    else {
      return t('Index already exist');
    }
  }
}