function privatemsg_update_6204 in Privatemsg 6.2
Update indexes for 6.x-2.x instances.
File
- ./
privatemsg.install, line 664 - Install file for privatemsg.module
Code
function privatemsg_update_6204() {
$ret = array();
// Remove whatever old indexes are on the tables.
$old = array(
'pm_index' => array(
'mid',
'thread_id',
'recipient',
'is_new',
),
'pm_message' => array(
'author',
'subject',
'timestamp',
),
);
foreach ($old as $table => $indexes) {
foreach ($indexes as $name) {
if (privatemsg_db_index_exists($table, $name)) {
db_drop_index($ret, $table, $name);
}
}
}
$new = array(
'list' => array(
'recipient',
'type',
'deleted',
'is_new',
),
'messages' => array(
'mid',
'recipient',
'type',
),
'participants' => array(
'thread_id',
'recipient',
'type',
'deleted',
),
);
foreach ($new as $name => $fields) {
if (!privatemsg_db_index_exists('pm_index', $name)) {
db_add_index($ret, 'pm_index', $name, $fields);
}
}
return $ret;
}