workspaces.install
Same filename and directory in other branches
Contains install, update and uninstall functions for the Workspaces module.
File
-
core/
modules/ workspaces/ workspaces.install
View source
<?php
/**
* @file
* Contains install, update and uninstall functions for the Workspaces module.
*/
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Entity\EntityTypeInterface;
/**
* Implements hook_schema().
*/
function workspaces_schema() : array {
$schema['workspace_association'] = [
'description' => 'Stores the latest entity revisions tracked by a 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,
'default' => 0,
'description' => 'The ID of the associated entity.',
],
'target_entity_id_string' => [
'type' => 'varchar_ascii',
'length' => 128,
'not null' => TRUE,
'default' => '',
'description' => 'The string ID of the associated entity.',
],
'target_entity_revision_id' => [
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The revision ID of the associated entity.',
],
],
'primary key' => [
'workspace',
'target_entity_type_id',
'target_entity_id',
'target_entity_id_string',
],
'indexes' => [
'target_entity_revision_id' => [
'target_entity_revision_id',
],
],
];
$schema['workspace_association_revision'] = NestedArray::mergeDeep($schema['workspace_association'], [
'description' => 'Stores all entity revisions tracked by a workspace.',
'fields' => [
'initial_revision' => [
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
'description' => 'Whether this entity was created in the workspace.',
],
],
]);
$schema['workspace_association_revision']['primary key'] = [
'workspace',
'target_entity_type_id',
'target_entity_id',
'target_entity_id_string',
'target_entity_revision_id',
];
$schema['workspace_association_revision']['indexes'] = [
'initial_revision' => [
'initial_revision',
],
];
return $schema;
}
/**
* Implements hook_update_last_removed().
*/
function workspaces_update_last_removed() : int {
return 11303;
}
/**
* Implements hook_update_dependencies().
*/
function workspaces_update_dependencies() : array {
// The workspaces updates must run after the router table is
// updated since it triggers route rebuilds due to the module install.
$dependencies['workspaces'][11102] = [
'system' => 11201,
];
return $dependencies;
}
Functions
| Title | Deprecated | Summary |
|---|---|---|
| workspaces_schema | Implements hook_schema(). | |
| workspaces_update_dependencies | Implements hook_update_dependencies(). | |
| workspaces_update_last_removed | Implements hook_update_last_removed(). |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.