You are here

function webform_invitation_schema in Webform Invitation 7.2

Same name and namespace in other branches
  1. 8 webform_invitation.install \webform_invitation_schema()
  2. 7 webform_invitation.install \webform_invitation_schema()
  3. 2.0.x webform_invitation.install \webform_invitation_schema()
1 call to webform_invitation_schema()
webform_invitation_update_7202 in ./webform_invitation.install
Alter generated column name since GENERATED is a MySQL reserved word as of 5.7.6.

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' => '',
      ),
      'time_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,
      ),
      'sid' => array(
        'description' => 'The submission ID using this code.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    '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,
      ),
      'cid' => array(
        'description' => 'Component ID of Webform Invitation textfield.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'nid',
    ),
  );
  return $schema;
}