You are here

function menu_entity_index_schema in Menu Entity Index 8

Implements hook_schema().

File

./menu_entity_index.install, line 13
Hooks related to (un-)installation of Menu Entity Index module.

Code

function menu_entity_index_schema() {
  $schema['menu_entity_index'] = [
    'description' => 'Maintains an index of menu links and their referenced entities.',
    'fields' => [
      'menu_name' => [
        'description' => 'Menu name of host entity.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
      ],
      'level' => [
        'description' => 'Menu level of the host entity.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ],
      'entity_type' => [
        'description' => 'The entity type of the host entity.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
      ],
      'entity_subtype' => [
        'description' => 'The entity subtype of the host entity.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
      ],
      'entity_id' => [
        'description' => 'The entity id of the host entity.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ],
      'entity_uuid' => [
        'description' => 'The uuid of the host entity.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
      ],
      'parent_type' => [
        'description' => 'The entity type of the parent entity.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
      ],
      'parent_id' => [
        'description' => 'The entity id of the parent entity.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => FALSE,
      ],
      'parent_uuid' => [
        'description' => 'The uuid of the parent entity.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
      ],
      'langcode' => [
        'description' => 'The language code of the host entity.',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
      ],
      'target_type' => [
        'description' => 'The entity type of the target entity.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
      ],
      'target_subtype' => [
        'description' => 'The entity subtype of the target entity.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
      ],
      'target_id' => [
        'description' => 'The entity id of the target entity.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ],
      'target_uuid' => [
        'description' => 'The uuid of the target entity.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
      ],
      'target_langcode' => [
        'description' => 'The language code of the target entity.',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
      ],
    ],
    'primary key' => [
      'menu_name',
      'entity_uuid',
      'parent_uuid',
      'target_uuid',
      'langcode',
      'target_langcode',
    ],
    'indexes' => [
      'host_entity' => [
        'entity_type',
        'entity_subtype',
        'entity_id',
        'langcode',
      ],
      'target_entity' => [
        'target_type',
        'target_subtype',
        'target_id',
        'target_langcode',
      ],
      'target_id' => [
        'target_id',
      ],
      'target_type' => [
        'target_type',
      ],
      'target_langcode' => [
        'target_langcode',
      ],
    ],
  ];
  return $schema;
}