You are here

function invite_schema in Invite 7.2

Same name and namespace in other branches
  1. 6.2 invite.install \invite_schema()
  2. 7.4 invite.install \invite_schema()

Implements hook_schema().

File

./invite.install, line 11
Installation file for invite module.

Code

function invite_schema() {
  $schema['invite'] = array(
    'description' => 'The base table for invites.',
    'fields' => array(
      'iid' => array(
        'description' => 'The primary identifier for a invite.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'reg_code' => array(
        'description' => 'Stores the issued registration code and acts as primary identifier for a invite.',
        'type' => 'varchar',
        'length' => 8,
        'not null' => TRUE,
        'default' => '',
      ),
      'email' => array(
        'description' => 'Stores the e-mail the invite has been addressed to.',
        'type' => 'varchar',
        'length' => 100,
        'not null' => TRUE,
        'default' => '',
      ),
      'uid' => array(
        'description' => 'Stores the user id of the inviter.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'invitee' => array(
        'description' => 'Stores the user id of the invitee upon registration.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'created' => array(
        'description' => 'Stores the creation time of the invite.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'expiry' => array(
        'description' => 'Stores the expiry time of the invite.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'joined' => array(
        'description' => 'Will be filled with the time the invite was accepted upon registration.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'canceled' => array(
        'description' => 'Stores whether the invite has been withdrawn.',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'resent' => array(
        'description' => 'Stores how many times the invite has been resent.',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'data' => array(
        'description' => 'Stores auxiliary data.',
        'type' => 'text',
        'not null' => TRUE,
      ),
    ),
    'unique keys' => array(
      'reg_code' => array(
        'reg_code',
      ),
    ),
    'indexes' => array(
      'email' => array(
        'email',
      ),
      'uid' => array(
        'uid',
      ),
    ),
    'primary key' => array(
      'iid',
    ),
  );
  $schema['invite_notifications'] = array(
    'description' => 'Stores notifications of inviters.',
    'fields' => array(
      'uid' => array(
        'description' => 'Stores the user id to be notified (inviter).',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'invitee' => array(
        'description' => 'Stores the user id of the invitee.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'unique keys' => array(
      'uid_invitee' => array(
        'uid',
        'invitee',
      ),
    ),
  );
  return $schema;
}