View source
<?php
function regcode_roles_update_6001() {
$sql = array();
$schema = regcode_roles_schema();
db_drop_table($sql, 'regcode_roles');
db_create_table($sql, 'regcode_roles', $schema['regcode_roles']);
return $sql;
}
function regcode_roles_uninstall() {
drupal_uninstall_schema('regcode_roles');
}
function regcode_roles_install() {
drupal_install_schema('regcode_roles');
}
function regcode_roles_schema() {
$schema['regcode_roles'] = array(
'description' => t('Store registration role rules'),
'fields' => array(
'id' => array(
'description' => t('ID'),
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'term_id' => array(
'description' => t('Term ID'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'role_id' => array(
'description' => t('Role ID'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'expire_date' => array(
'description' => t('Expiration date'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
),
'expire_duration' => array(
'description' => t('Expiration duration'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
),
),
'primary key' => array(
'id',
),
);
return $schema;
}