function role_expire_update_6100 in Role Expire 6
File
- ./
role_expire.install, line 75 - Role expire install.
Code
function role_expire_update_6100() {
$roles = user_roles(true);
unset($roles[DRUPAL_AUTHENTICATED_RID]);
$schema = array();
$ret = array();
foreach ($roles as $rid => $role) {
$schema['role_expire_' . $rid] = array(
'description' => 'Expiry information for ' . $role,
'fields' => array(
'uid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'User ID connected with expiry date.',
),
'expiry_timestamp' => array(
'description' => 'Role expiry timestamp.',
'type' => 'varchar',
'not null' => TRUE,
'length' => 255,
),
),
'indexes' => array(
'uid' => array(
'uid',
),
),
);
if (db_table_exists("role_expire_" . $role)) {
db_rename_table($ret, "role_expire_" . $role, "role_expire_" . $rid);
}
else {
db_create_table($ret, "role_expire_" . $rid, $schema["role_expire_" . $rid]);
}
}
return $ret;
}