'id', 'privatemsg_folder' => 'fid') as $table => $id) { $ret[] = update_sql(sprintf($sql, $table, $id)); $max = db_result(db_query('SELECT max('. $id .') FROM {'. $table .'}')); if ($table == 'privatemsg') { $max = max($max, db_result(db_query('SELECT max(id) FROM {privatemsg_archive}'))); } $ret[] = update_sql(sprintf($seq, '{'. $table .'}_'. $id, $max)); } $ret[] = update_sql(sprintf($sql, 'privatemsg_archive', 'id')); return $ret; } 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; }