You are here

function privatemsg_update_3 in Privatemsg 5

Same name and namespace in other branches
  1. 5.3 privatemsg.install \privatemsg_update_3()

File

./privatemsg.install, line 220

Code

function privatemsg_update_3() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $ret[] = update_sql('ALTER TABLE {privatemsg} ADD thread int NOT NULL');
      $ret[] = update_sql('ALTER TABLE {privatemsg_archive} ADD thread int NOT NULL');
      break;
    case 'pgsql':
      foreach (array(
        'privatemsg',
        'privatemsg_archive',
      ) as $table) {
        $ret[] = update_sql("ALTER TABLE {$table} ADD thread int");
        $ret[] = update_sql("ALTER TABLE {$table} ALTER COLUMN thread SET DEFAULT 0");
        $ret[] = update_sql("UPDATE {$table} SET thread = 0");
        $ret[] = update_sql("ALTER TABLE {$table} ALTER COLUMN thread SET NOT NULL");
      }
      break;
  }
  return $ret;
}