You are here

function role_expire_schema in Role Expire 7

Same name and namespace in other branches
  1. 8 role_expire.install \role_expire_schema()
  2. 6 role_expire.install \role_expire_schema()
  3. 2.x role_expire.install \role_expire_schema()

Implementation of hook_schema().

File

./role_expire.install, line 12
Role expire install.

Code

function role_expire_schema() {
  $schema['role_expire'] = array(
    'description' => t('Expiration time for the user roles.'),
    'fields' => array(
      'uid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => t('User ID connected with expiration time.'),
      ),
      'rid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The role ID assigned to the user.',
      ),
      'expiry_timestamp' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('Role expiration timestamp.'),
      ),
    ),
    'primary key' => array(
      'uid',
      'rid',
    ),
  );
  $schema['role_expire_length'] = array(
    'description' => t('Length in days to assign each role by default.'),
    'fields' => array(
      'rid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => t('The role_id.'),
      ),
      'duration' => array(
        'type' => 'text',
        'size' => 'small',
        'not null' => TRUE,
        'description' => t('A strtotime-compatible default duration string.'),
      ),
    ),
    'primary key' => array(
      'rid',
    ),
  );
  return $schema;
}