You are here

function webform_invitation_schema in Webform Invitation 7

Same name and namespace in other branches
  1. 8 webform_invitation.install \webform_invitation_schema()
  2. 7.2 webform_invitation.install \webform_invitation_schema()
  3. 2.0.x webform_invitation.install \webform_invitation_schema()

File

./webform_invitation.install, line 3

Code

function webform_invitation_schema() {
  $schema['webform_invitation_codes'] = array(
    'description' => 'Table for storing generated form tokens.',
    'fields' => array(
      'cid' => array(
        'description' => 'The primary identifier for a code.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'nid' => array(
        'description' => 'The primary identifier for a node.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'code' => array(
        'description' => 'A code for the webform.',
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ),
      'generated' => array(
        'description' => 'The Unix timestamp when the code was generated.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'used' => array(
        'description' => 'The Unix timestamp when the code was used.',
        'type' => 'int',
        'not null' => FALSE,
        'default' => NULL,
      ),
    ),
    'indexes' => array(
      'nid' => array(
        'nid',
      ),
      'used' => array(
        'used',
      ),
    ),
    'unique keys' => array(
      'nid_code' => array(
        'nid',
        'code',
      ),
    ),
    'primary key' => array(
      'cid',
    ),
  );
  $schema['webform_invitation'] = array(
    'description' => 'Table for storing invitation settings.',
    'fields' => array(
      'nid' => array(
        'description' => 'The primary identifier for a node.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'invitation' => array(
        'description' => 'Use invitation codes?',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'nid',
    ),
  );
  return $schema;
}