taxonomy_entity_index.install in Taxonomy Entity Index 8
Same filename and directory in other branches
Install file for taxonomy_entity_index.
File
taxonomy_entity_index.installView source
<?php
/**
* @file
* Install file for taxonomy_entity_index.
*/
/**
* Implements hook_schema().
*/
function taxonomy_entity_index_schema() {
$schema['taxonomy_entity_index'] = [
'description' => 'Maintains denormalized information about entity/term relationships.',
'fields' => [
'entity_type' => [
'description' => 'The entity type this term is attached to.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
],
'bundle' => [
'description' => 'The entity bundle this term is attached to.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
],
'entity_id' => [
'description' => 'The entity ID this term is attached to.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
],
'revision_id' => [
'description' => 'The entity revision ID this term is attached to.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
'field_name' => [
'description' => 'The field name the term is attached to.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
],
'delta' => [
'description' => 'The delta order of the term in the field.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
'tid' => [
'description' => 'The term ID.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
],
'primary key' => [
'entity_type',
'entity_id',
'revision_id',
'field_name',
'delta',
],
'indexes' => [
'field_instance' => [
'field_name',
'entity_type',
'bundle',
],
'tid' => [
'tid',
],
'revision_id' => [
'revision_id',
],
],
'foreign keys' => [
'term' => [
'table' => 'taxonomy_term_data',
'columns' => [
'tid' => 'tid',
],
],
],
];
return $schema;
}
/**
* Add an index on revision_id.
*/
function taxonomy_entity_index_update_8001() {
$database = Drupal::database();
$spec = [
'fields' => [
'revision_id' => [
'description' => 'The entity revision ID this term is attached to.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
],
];
$database
->schema()
->addIndex('taxonomy_entity_index', 'revision_id', [
'revision_id',
], $spec);
}
Functions
Name | Description |
---|---|
taxonomy_entity_index_schema | Implements hook_schema(). |
taxonomy_entity_index_update_8001 | Add an index on revision_id. |