You are here

function apply_for_role_schema in Apply for role 7

Same name and namespace in other branches
  1. 8 apply_for_role.install \apply_for_role_schema()
  2. 6 apply_for_role.install \apply_for_role_schema()
  3. 7.2 apply_for_role.install \apply_for_role_schema()

Implements hook_schema().

File

./apply_for_role.install, line 17
Installs the Apply for Role (AFR) module.

Code

function apply_for_role_schema() {
  $schema['users_roles_apply'] = array(
    'fields' => array(
      'aid' => array(
        'type' => 'serial',
        'description' => 'Primary Key: Unique role application ID.',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'uid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Foreign Key: {users}.uid.',
      ),
      'rid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Foreign Key: {role}.rid.',
      ),
      'approved' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny',
        'description' => 'The status of the role application.',
      ),
      'message' => array(
        'type' => 'text',
        'size' => 'big',
        'description' => 'The message written by the role applicant.',
      ),
      'apply_date' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Timestamp for when the role application was created.',
      ),
      'approve_date' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Timestamp for when the role application was processed.',
      ),
    ),
    'unique keys' => array(
      'uid_rid' => array(
        'uid',
        'rid',
      ),
    ),
    'primary key' => array(
      'aid',
    ),
  );
  return $schema;
}