function webform_update_8191 in Webform 6.x
Same name and namespace in other branches
- 8.5 includes/webform.install.update.inc \webform_update_8191()
Issue #3121814: Webform submission check taking a long time.
File
- includes/
webform.install.update.inc, line 3544 - Archived Webform update hooks.
Code
function webform_update_8191() {
// Copied from: history_update_8101()
// @see https://www.drupal.org/docs/8/api/update-api/updating-database-schema-andor-data-in-drupal-8
$spec = [
'description' => 'The base table for webform_submission entities.',
'fields' => [
'sid' => [
'type' => 'serial',
'unsigned' => FALSE,
'size' => 'normal',
'not null' => TRUE,
],
'webform_id' => [
'description' => 'The ID of the target entity.',
'type' => 'varchar_ascii',
'length' => 32,
'not null' => TRUE,
],
'uuid' => [
'type' => 'varchar_ascii',
'length' => 128,
'binary' => FALSE,
'not null' => TRUE,
],
'langcode' => [
'type' => 'varchar_ascii',
'length' => 12,
'not null' => TRUE,
],
'serial' => [
'type' => 'int',
'unsigned' => FALSE,
'size' => 'normal',
'not null' => FALSE,
],
'token' => [
'type' => 'varchar',
'length' => 255,
'binary' => FALSE,
'not null' => FALSE,
],
'uri' => [
'type' => 'varchar',
'length' => 2000,
'binary' => FALSE,
'not null' => FALSE,
],
'created' => [
'type' => 'int',
'not null' => FALSE,
],
'completed' => [
'type' => 'int',
'not null' => FALSE,
],
'changed' => [
'type' => 'int',
'not null' => FALSE,
],
'in_draft' => [
'type' => 'int',
'size' => 'tiny',
'not null' => FALSE,
],
'current_page' => [
'type' => 'varchar',
'length' => 128,
'binary' => FALSE,
'not null' => FALSE,
],
'remote_addr' => [
'type' => 'varchar',
'length' => 128,
'binary' => FALSE,
'not null' => FALSE,
],
'uid' => [
'description' => 'The ID of the target entity.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
],
'entity_type' => [
'type' => 'varchar_ascii',
'length' => 32,
'binary' => FALSE,
'not null' => FALSE,
],
'entity_id' => [
'type' => 'varchar',
'length' => 255,
'binary' => FALSE,
'not null' => FALSE,
],
'locked' => [
'type' => 'int',
'size' => 'tiny',
'not null' => FALSE,
],
'sticky' => [
'type' => 'int',
'size' => 'tiny',
'not null' => FALSE,
],
'notes' => [
'type' => 'text',
'size' => 'big',
'not null' => FALSE,
],
],
'unique keys' => [
'webform_submission_field__uuid__value' => [
'uuid',
],
],
'primary key' => [
'sid',
],
'indexes' => [
'webform_submission_field__webform_id__target_id' => [
'webform_id',
],
'webform_submission_field__uid__target_id' => [
'uid',
],
'webform_submission_field__token' => [
'token',
],
],
'foreign keys' => [],
];
Database::getConnection()
->schema()
->addIndex('webform_submission', 'webform_submission__token', [
'token',
], $spec);
}