You are here

function webform_invitation_schema in Webform Invitation 2.0.x

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. 7 webform_invitation.install \webform_invitation_schema()

Implements hook_schema().

File

./webform_invitation.install, line 11
Installation functions for the Webform Invitation module.

Code

function webform_invitation_schema() {
  $schema['webform_invitation_codes'] = [
    'description' => 'Table for storing generated form tokens.',
    'fields' => [
      'cid' => [
        'description' => 'The primary identifier for a code.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ],
      'webform' => [
        'description' => 'The primary identifier for a webform.',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ],
      'code' => [
        'description' => 'A code for the webform.',
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ],
      'created' => [
        'description' => 'The Unix timestamp when the code was generated.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ],
      'used' => [
        'description' => 'The Unix timestamp when the code was used.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ],
      'sid' => [
        'description' => 'The submission ID using this code.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ],
    ],
    'primary key' => [
      'cid',
    ],
    'unique keys' => [
      'webform_code' => [
        'webform',
        'code',
      ],
    ],
    'indexes' => [
      'webform' => [
        'webform',
      ],
      'used' => [
        'used',
      ],
    ],
  ];
  return $schema;
}