You are here

function taxonomy_entity_index_schema in Taxonomy Entity Index 7

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

Implements hook_schema().

File

./taxonomy_entity_index.install, line 6

Code

function taxonomy_entity_index_schema() {
  $schema['taxonomy_entity_index'] = array(
    'description' => 'Maintains denormalized information about entity/term relationships.',
    'fields' => array(
      'entity_type' => array(
        'description' => 'The entity type this term is attached to.',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
      ),
      'bundle' => array(
        'description' => 'The entity bundle this term is attached to.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
      'entity_id' => array(
        'description' => 'The entity ID this term is attached to.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'revision_id' => array(
        'description' => 'The entity revision ID this term is attached to.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'field_name' => array(
        'description' => 'The field name the term is attached to.',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'delta' => array(
        'description' => 'The delta order of the term in the field.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'tid' => array(
        'description' => 'The term ID.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'entity_type',
      'entity_id',
      'revision_id',
      'field_name',
      'delta',
    ),
    'indexes' => array(
      'field_instance' => array(
        'field_name',
        'entity_type',
        'bundle',
      ),
      'tid' => array(
        'tid',
      ),
    ),
    'foreign keys' => array(
      'term' => array(
        'table' => 'taxonomy_term_data',
        'columns' => array(
          'tid' => 'tid',
        ),
      ),
    ),
  );
  return $schema;
}