function workspaces_update_11101

Update workspace associations to support entity types with string IDs.

File

core/modules/workspaces/workspaces.install, line 71

Code

function workspaces_update_11101() : void {
  $schema = \Drupal::database()->schema();
  $target_id_spec = [
    'type' => 'int',
    'unsigned' => TRUE,
    'not null' => TRUE,
    'default' => 0,
    'description' => 'The ID of the associated entity.',
  ];
  $schema->changeField('workspace_association', 'target_entity_id', 'target_entity_id', $target_id_spec);
  $target_id_string_spec = [
    'type' => 'varchar_ascii',
    'length' => 128,
    'not null' => TRUE,
    'default' => '',
    'description' => 'The string ID of the associated entity.',
  ];
  $schema->addField('workspace_association', 'target_entity_id_string', $target_id_string_spec, [
    'primary key' => [
      'workspace',
      'target_entity_type_id',
      'target_entity_id',
      'target_entity_id_string',
    ],
  ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.