You are here

webform_invitation.install in Webform Invitation 7

File

webform_invitation.install
View source
<?php

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;
}

Functions