function entity_usage_schema in Entity Usage 8
Same name and namespace in other branches
- 8.4 entity_usage.install \entity_usage_schema()
- 8.2 entity_usage.install \entity_usage_schema()
- 8.3 entity_usage.install \entity_usage_schema()
Implements hook_schema().
File
- ./
entity_usage.install, line 11 - Install, update and uninstall functions for entity_usage module.
Code
function entity_usage_schema() {
$schema['entity_usage'] = [
'description' => 'Track entities that reference other entities.',
'fields' => [
't_id' => [
'description' => 'Target entity ID.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
],
't_type' => [
'description' => 'The type of the target entity.',
'type' => 'varchar_ascii',
'length' => 128,
'not null' => TRUE,
'default' => '',
],
're_id' => [
'description' => 'Referencing entity ID.',
'type' => 'varchar_ascii',
'length' => 64,
'not null' => TRUE,
'default' => 0,
],
're_type' => [
'description' => 'The type of the referencing entity.',
'type' => 'varchar_ascii',
'length' => 128,
'not null' => TRUE,
'default' => '',
],
'method' => [
'description' => 'The method used to reference both entities, generally the plugin ID.',
'type' => 'varchar_ascii',
'length' => 128,
'not null' => TRUE,
'default' => '',
],
'count' => [
'description' => 'The number of times this entity is referenced in this case.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
],
'primary key' => [
't_id',
't_type',
're_id',
're_type',
'method',
],
'indexes' => [
'ttype_tid' => [
't_type',
't_id',
],
'tid_ttype_count' => [
't_id',
't_type',
'count',
],
],
];
return $schema;
}