You are here

function profanity_update_7100 in Profanity 7

Add the missing CTEX title field, remove incorrect id field and switch up the index.

File

./profanity.install, line 104
Install file for profanity.

Code

function profanity_update_7100() {
  if (!db_field_exists('profanity_list', 'title')) {
    db_drop_index('profanity_list', 'name');
    db_drop_primary_key('profanity_list');
    db_add_primary_key('profanity_list', array(
      'name',
    ));
    db_drop_field('profanity_list', 'id');
    db_add_field('profanity_list', 'title', array(
      'description' => 'The human-readable title for this list.',
      'type' => 'varchar',
      'length' => '255',
      'not null' => FALSE,
      'default' => '',
    ));
    db_query('UPDATE {profanity_list} SET title = name');
  }
}