You are here

function yamlform_update_8054 in YAML Form 8

Issue #2806263: Add property column to submission data table. Add serial column.

File

includes/yamlform.update.inc, line 1140
YAML Form module update hooks.

Code

function yamlform_update_8054() {

  // @see https://www.drupal.org/node/2554097
  // From: \Drupal\yamlform\Entity\YamlFormSubmission::baseFieldDefinitions
  $definitions = [];
  $definitions['serial'] = BaseFieldDefinition::create('integer')
    ->setLabel(t('Serial number'))
    ->setDescription(t('The serial number of the form submission entity.'))
    ->setReadOnly(TRUE);
  foreach ($definitions as $name => $definition) {
    \Drupal::entityDefinitionUpdateManager()
      ->installFieldStorageDefinition($name, 'yamlform_submission', 'yamlform_submission', $definition);
  }
}