You are here

function taxonomy_entity_index_schema in Taxonomy Entity Index 8

Same name and namespace in other branches
  1. 7 taxonomy_entity_index.install \taxonomy_entity_index_schema()

Implements hook_schema().

File

./taxonomy_entity_index.install, line 11
Install file for taxonomy_entity_index.

Code

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;
}