function comment_update_7002

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

Related topics

File

modules/comment/comment.install, line 162

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',
    ));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.