You are here

function webform_update_8061 in Webform 6.x

Same name and namespace in other branches
  1. 8.5 includes/webform.install.update.inc \webform_update_8061()

Issue #2871207: Random Multiple Submissions. Create webform table.

File

includes/webform.install.update.inc, line 1238
Archived Webform update hooks.

Code

function webform_update_8061() {

  // Issue #2923303: Problems with updating the webform module.
  if (\Drupal::database()
    ->schema()
    ->tableExists('webform')) {
    \Drupal::database()
      ->schema()
      ->dropTable('webform');
  }

  // Copied from: webform_schema().
  $schema = [
    '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',
    ],
  ];
  \Drupal::database()
    ->schema()
    ->createTable('webform', $schema);
}