You are here

function workspaces_schema in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/workspaces/workspaces.install \workspaces_schema()

Implements hook_schema().

File

core/modules/workspaces/workspaces.install, line 85
Contains install, update and uninstall functions for the Workspaces module.

Code

function workspaces_schema() {
  $schema['workspace_association'] = [
    'description' => 'Stores the association between entity revisions and their workspace.',
    'fields' => [
      'workspace' => [
        'type' => 'varchar_ascii',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The workspace ID.',
      ],
      'target_entity_type_id' => [
        'type' => 'varchar_ascii',
        'length' => EntityTypeInterface::ID_MAX_LENGTH,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The ID of the associated entity type.',
      ],
      'target_entity_id' => [
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'The ID of the associated entity.',
      ],
      'target_entity_revision_id' => [
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'The revision ID of the associated entity.',
      ],
    ],
    'indexes' => [
      'target_entity_revision_id' => [
        'target_entity_revision_id',
      ],
    ],
    'primary key' => [
      'workspace',
      'target_entity_type_id',
      'target_entity_id',
    ],
  ];
  return $schema;
}