function invite_update_201 in Invite 7.2
Same name and namespace in other branches
- 5.2 invite.install \invite_update_201()
- 6.2 invite.install \invite_update_201()
Revamped notification system.
File
- ./
invite.install, line 373 - Installation file for invite module.
Code
function invite_update_201() {
$ret = array();
db_create_table('invite_notifications', array(
'description' => 'Stores notifications of inviters.',
'fields' => array(
'uid' => array(
'description' => 'Stores the user id to be notified (inviter).',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'invitee' => array(
'description' => 'Stores the user id of the invitee.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
),
'indexes' => array(
'uid' => array(
'uid',
),
),
));
// Convert old data
// @TODO: Should be converted to db_insert
db_query("INSERT INTO {invite_notifications} (uid, invitee) SELECT uid, invitee FROM {invite} WHERE joined <> 0 AND received = 0");
// Drop old column
db_drop_field('invite', 'received');
return $ret;
}