You are here

function user_external_invite_schema in User External Invite 7

Same name and namespace in other branches
  1. 7.2 user_external_invite.install \user_external_invite_schema()
  2. 1.0.x user_external_invite.install \user_external_invite_schema()

Implements hook_schema().

File

./user_external_invite.install, line 11
Set-up database schema and install tasks for user_external_invite module.

Code

function user_external_invite_schema() {
  $schema['user_external_invite'] = array(
    'description' => 'Stores invites',
    'fields' => array(
      'id' => array(
        'description' => 'Primary key of the Invite entity',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'mail' => array(
        'description' => 'Email address',
        'type' => 'varchar',
        'length' => 254,
        'not null' => TRUE,
        'default' => variable_get('site_mail', 'admin@example.com'),
      ),
      'rid' => array(
        'description' => 'Role ID to be granted',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 2,
      ),
      'expire' => array(
        'description' => 'Valid until unix timestamp',
        'type' => 'int',
        'not null' => TRUE,
        'default' => REQUEST_TIME + 60 * 60 * 24 * 5,
      ),
      'status' => array(
        'description' => 'Status of the Invitation',
        'type' => 'varchar',
        'length' => 254,
        'not null' => TRUE,
        'default' => 'Pending',
      ),
      'uid' => array(
        'description' => 'User ID of who sent the invite',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 1,
      ),
      'message' => array(
        'description' => 'Custom message included with invite',
        'type' => 'text',
        'not null' => FALSE,
      ),
    ),
    'primary key' => array(
      'id',
    ),
    'indexes' => array(
      'invite_expired' => array(
        'expire',
      ),
    ),
  );
  return $schema;
}