You are here

function apply_for_role_schema in Apply for role 8

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

Implements hook_schema().

Establishes the table that stores apply for role applications.

File

./apply_for_role.install, line 8

Code

function apply_for_role_schema() {
  $schema['apply_for_role_applications'] = array(
    'description' => 'Stores email, timestamp, NID and UID for an RSVP',
    'fields' => array(
      'aid' => array(
        'description' => 'Application ID. The primary identifier for the record',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'uid' => array(
        'description' => 'The {users}.uid that submitted the application.',
        'type' => 'int',
        'not null' => TRUE,
      ),
      'rids' => array(
        'description' => 'The {role}.rid\'s that a user has applied for, encoded in JSON',
        'type' => 'varchar',
        'length' => 600,
        'not null' => TRUE,
      ),
      'status' => array(
        'description' => 'The status of the user application. 0 for not reviewed, 1 for accepted, 2 for denied.',
        'type' => 'int',
        'length' => 1,
        'not null' => TRUE,
        'default' => 0,
      ),
      'created' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Timestamp for when RSVP was created.',
      ),
      'message' => array(
        'description' => '(optional) User message explaining application.',
        'type' => 'varchar',
        'length' => 600,
        'not null' => FALSE,
        'default' => '',
      ),
    ),
    'primary key' => array(
      'aid',
    ),
    'indexes' => array(
      'users' => array(
        'uid',
      ),
    ),
  );
  return $schema;
}