View source
<?php
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('Registration code role assignment information'),
'fields' => array(
'id' => array(
'description' => t('Rule ID'),
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'disp-width' => '11',
),
'category' => array(
'description' => t('Category of regcode used'),
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
'default' => '',
),
'role' => array(
'description' => t('Role ID'),
'type' => 'int',
'unsigned' => TRUE,
'disp-width' => '11',
),
'expire_date' => array(
'description' => t('Role expiration date'),
'type' => 'int',
'not null' => FALSE,
'unsigned' => TRUE,
),
'expire_duration' => array(
'description' => t('Role expiration duration'),
'type' => 'int',
'not null' => FALSE,
'unsigned' => TRUE,
),
),
'primary key' => array(
'id',
),
);
return $schema;
}