function privatemsg_update_7003 in Privatemsg 7.2
Same name and namespace in other branches
- 7 privatemsg.install \privatemsg_update_7003()
Change schema to allow other recipients than single users.
File
- ./
privatemsg.install, line 261 - Install file for privatemsg.module
Code
function privatemsg_update_7003() {
// Make sure to not run this update twice.
if (db_field_exists('pm_index', 'recipient')) {
return;
}
db_drop_index('pm_index', 'list');
db_drop_index('pm_index', 'messages');
db_drop_index('pm_index', 'participants');
db_change_field('pm_index', 'uid', 'recipient', array(
'description' => 'ID of the recipient object, typically user',
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
));
db_add_field('pm_index', 'type', array(
'description' => 'Type of recipient object',
'type' => 'varchar',
'not null' => TRUE,
'length' => '255',
'default' => 'user',
), array(
'indexes' => array(
'list' => array(
'recipient',
'type',
'deleted',
'is_new',
),
'messages' => array(
'mid',
'recipient',
'type',
),
'participants' => array(
'thread_id',
'recipient',
'type',
'deleted',
),
),
));
}