function webform_update_8082 in Webform 6.x
Same name and namespace in other branches
- 8.5 includes/webform.install.update.inc \webform_update_8082()
Issue #2912672: Mismatch entity Webform submission caused by langcode changes.
File
- includes/
webform.install.update.inc, line 1638 - Archived Webform update hooks.
Code
function webform_update_8082() {
// Set webform_submission.langcode to NOT NULL.
// Copied from: system_update_8007().
$schema = \Drupal::keyValue('entity.storage_schema.sql')
->getAll();
$item =& $schema['webform_submission.field_schema_data.langcode'];
foreach ($item as &$table_schema) {
foreach ($table_schema['fields'] as &$field) {
$field['not null'] = TRUE;
}
}
\Drupal::keyValue('entity.storage_schema.sql')
->setMultiple($schema);
// Update field definition.
// Copied from: node_update_8300().
$spec = [
'type' => 'varchar_ascii',
'length' => 12,
'not null' => TRUE,
];
Database::getConnection()
->schema()
->changeField('webform_submission', 'langcode', 'langcode', $spec);
}