You are here

function webform_schema in Webform 8.5

Same name and namespace in other branches
  1. 6.3 webform.install \webform_schema()
  2. 6.2 webform.install \webform_schema()
  3. 7.4 webform.install \webform_schema()
  4. 7.3 webform.install \webform_schema()
  5. 6.x webform.install \webform_schema()

Implements hook_schema().

Even though Webform's are config entities we need to create a 'webform' table to track webform submission serial numbers using DB transaction locking.

See also

\Drupal\webform\WebformEntityStorage

File

./webform.install, line 43
Install, update and uninstall functions for the Webform module.

Code

function webform_schema() {
  $schema['webform'] = [
    'description' => 'Stores all webform data.',
    'fields' => [
      'webform_id' => [
        'description' => 'The webform id.',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
      ],
      'next_serial' => [
        'description' => 'The serial number to give to the next submission to this webform.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 1,
      ],
    ],
    'primary key' => [
      'webform_id',
      'next_serial',
    ],
  ];
  return $schema;
}