You are here

function comment_update_7002 in Drupal 7

Rename {comments} table to {comment} and upgrade it.

Related topics

File

modules/comment/comment.install, line 162
Install, update and uninstall functions for the comment module.

Code

function comment_update_7002() {
  db_rename_table('comments', 'comment');

  // Add user-related indexes. These may already exist from Drupal 6.
  if (!db_index_exists('comment', 'comment_uid')) {
    db_add_index('comment', 'comment_uid', array(
      'uid',
    ));
    db_add_index('node_comment_statistics', 'last_comment_uid', array(
      'last_comment_uid',
    ));
  }

  // Create a language column.
  db_add_field('comment', 'language', array(
    'type' => 'varchar',
    'length' => 12,
    'not null' => TRUE,
    'default' => '',
  ));
  db_add_index('comment', 'comment_nid_language', array(
    'nid',
    'language',
  ));
}