You are here

protected function RevisionTracker::schemaDefinition in Workbench Moderation 8

Same name and namespace in other branches
  1. 8.2 src/RevisionTracker.php \Drupal\workbench_moderation\RevisionTracker::schemaDefinition()

Defines the schema for the tracker table.

Return value

array The schema API definition for the SQL storage table.

1 call to RevisionTracker::schemaDefinition()
RevisionTracker::ensureTableExists in src/RevisionTracker.php
Checks if the table exists and create it if not.

File

src/RevisionTracker.php, line 114

Class

RevisionTracker
Tracks metadata about revisions across entities.

Namespace

Drupal\workbench_moderation

Code

protected function schemaDefinition() {
  $schema = [
    'description' => 'Tracks the latest revision for any entity',
    'fields' => [
      'entity_type' => [
        'description' => 'The entity type',
        'type' => 'varchar_ascii',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ],
      'entity_id' => [
        'description' => 'The entity ID',
        'type' => 'int',
        'length' => 255,
        'not null' => TRUE,
        'default' => 0,
      ],
      'langcode' => [
        'description' => 'The language of the entity revision',
        'type' => 'varchar',
        'length' => 12,
        'not null' => TRUE,
        'default' => '',
      ],
      'revision_id' => [
        'description' => 'The latest revision ID for this entity',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ],
    ],
    'primary key' => [
      'entity_type',
      'entity_id',
      'langcode',
    ],
  ];
  return $schema;
}