You are here

function ginvite_schema in Group 7

Implements hook_schema().

File

modules/ginvite/ginvite.install, line 63
Install, update and uninstall functions for the Group invite project.

Code

function ginvite_schema() {
  $schema['group_invite'] = array(
    'description' => 'Stores group e-mail invites.',
    'fields' => array(
      'iid' => array(
        'description' => 'Primary Key: Unique invite item ID.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'gid' => array(
        'description' => 'The {groups}.gid for the membership.',
        'type' => 'int',
        'default' => 0,
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'roles' => array(
        'description' => 'The group roles for the membership.',
        'type' => 'text',
        'not null' => TRUE,
        'serialize' => TRUE,
      ),
      'mail' => array(
        'description' => 'The e-mail address the invite is for.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'invited_on' => _ginvite_invited_on(),
      'invited_by' => _ginvite_invited_by(),
    ),
    'indexes' => array(
      'mail' => array(
        'mail',
      ),
    ),
    'foreign keys' => array(
      'group' => array(
        'table' => 'groups',
        'columns' => array(
          'gid' => 'gid',
        ),
      ),
      'inviter' => array(
        'table' => 'users',
        'columns' => array(
          'invited_by' => 'uid',
        ),
      ),
    ),
    'unique keys' => array(
      'membership' => array(
        'gid',
        'mail',
      ),
    ),
    'primary key' => array(
      'iid',
    ),
  );
  return $schema;
}