You are here

function drupalchat_update_7000 in DrupalChat 7

Same name and namespace in other branches
  1. 7.2 drupalchat.install \drupalchat_update_7000()

File

./drupalchat.install, line 129
Installation file for the DrupalChat module.

Code

function drupalchat_update_7000() {
  db_drop_index('drupalchat_msg', 'uid1');
  db_drop_index('drupalchat_msg', 'uid2');
  db_drop_primary_key('drupalchat_users');
  db_change_field('drupalchat_msg', 'uid1', 'uid1', array(
    'description' => 'Uid of the sender.',
    'type' => 'varchar',
    'length' => 32,
    'not null' => TRUE,
  ));
  db_change_field('drupalchat_msg', 'uid2', 'uid2', array(
    'description' => 'Uid of the receiver.',
    'type' => 'varchar',
    'length' => 32,
    'not null' => TRUE,
  ));
  if (!db_index_exists('drupalchat_msg', 'uid1')) {
    db_add_index('drupalchat_msg', 'uid1', array(
      'uid1',
    ));
  }
  if (!db_index_exists('drupalchat_msg', 'uid2')) {
    db_add_index('drupalchat_msg', 'uid2', array(
      'uid2',
    ));
  }
  if (!db_index_exists('drupalchat_users', 'uid')) {
    db_add_index('drupalchat_users', 'uid', array(
      'uid',
    ));
  }
  if (!db_index_exists('drupalchat_users', 'session')) {
    db_add_index('drupalchat_users', 'session', array(
      'session',
    ));
  }
}