You are here

function privatemsg_update_6001 in Privatemsg 6.2

Same name and namespace in other branches
  1. 6 privatemsg.install \privatemsg_update_6001()

File

./privatemsg.install, line 427
Install file for privatemsg.module

Code

function privatemsg_update_6001() {
  $ret = array();
  if (!db_column_exists('pm_index', 'is_new')) {
    if (db_column_exists('pm_index', 'new')) {
      $old_column = 'new';
    }
    elseif (db_column_exists('pm_index', 'new_flag')) {
      $old_column = 'new_flag';
    }
    else {
      return $ret;
    }
    db_drop_index($ret, 'pm_index', $old_column);
    db_change_field($ret, 'pm_index', $old_column, 'is_new', array(
      'description' => 'Whether the user has read this message',
      'type' => 'int',
      'default' => 1,
      'not null' => TRUE,
      'unsigned' => TRUE,
    ));
    db_add_index($ret, 'pm_index', 'is_new', array(
      'mid',
      'uid',
      'is_new',
    ));
  }
  return $ret;
}