163 lines
4.5 KiB
Plaintext
163 lines
4.5 KiB
Plaintext
<?php
|
|
|
|
/**
|
|
* @file
|
|
* Install, update and uninstall functions for the taxonomy module.
|
|
*/
|
|
|
|
/**
|
|
* Implements hook_schema().
|
|
*/
|
|
function taxonomy_schema() {
|
|
$schema['taxonomy_term_data'] = array(
|
|
'description' => 'Stores term information.',
|
|
'fields' => array(
|
|
'tid' => array(
|
|
'type' => 'serial',
|
|
'unsigned' => TRUE,
|
|
'not null' => TRUE,
|
|
'description' => 'Primary Key: Unique term ID.',
|
|
),
|
|
'uuid' => array(
|
|
'description' => 'Unique Key: Universally unique identifier for this entity.',
|
|
'type' => 'varchar',
|
|
'length' => 128,
|
|
'not null' => FALSE,
|
|
),
|
|
'vid' => array(
|
|
'type' => 'varchar',
|
|
'length' => 255,
|
|
'not null' => TRUE,
|
|
'default' => '',
|
|
'description' => 'The ID of the vocabulary to which the term is assigned.',
|
|
),
|
|
'langcode' => array(
|
|
'description' => 'The {language}.langcode of this term.',
|
|
'type' => 'varchar',
|
|
'length' => 12,
|
|
'not null' => TRUE,
|
|
'default' => '',
|
|
),
|
|
'name' => array(
|
|
'type' => 'varchar',
|
|
'length' => 255,
|
|
'not null' => TRUE,
|
|
'default' => '',
|
|
'description' => 'The term name.',
|
|
),
|
|
'description__value' => array(
|
|
'type' => 'text',
|
|
'not null' => FALSE,
|
|
'size' => 'big',
|
|
'description' => 'A description of the term.',
|
|
),
|
|
'description__format' => array(
|
|
'type' => 'varchar',
|
|
'length' => 255,
|
|
'not null' => FALSE,
|
|
'description' => 'The filter format ID of the description.',
|
|
),
|
|
'weight' => array(
|
|
'type' => 'int',
|
|
'not null' => TRUE,
|
|
'default' => 0,
|
|
'description' => 'The weight of this term in relation to other terms.',
|
|
),
|
|
'changed' => array(
|
|
'description' => 'The Unix timestamp when the term was most recently saved.',
|
|
'type' => 'int',
|
|
'not null' => TRUE,
|
|
'default' => 0,
|
|
),
|
|
),
|
|
'primary key' => array('tid'),
|
|
'unique keys' => array(
|
|
'uuid' => array('uuid'),
|
|
),
|
|
'indexes' => array(
|
|
'taxonomy_tree' => array(array('vid', 64), 'weight', 'name'),
|
|
'vid_name' => array(array('vid', 64), 'name'),
|
|
'name' => array('name'),
|
|
),
|
|
);
|
|
|
|
$schema['taxonomy_term_hierarchy'] = array(
|
|
'description' => 'Stores the hierarchical relationship between terms.',
|
|
'fields' => array(
|
|
'tid' => array(
|
|
'type' => 'int',
|
|
'unsigned' => TRUE,
|
|
'not null' => TRUE,
|
|
'default' => 0,
|
|
'description' => 'Primary Key: The {taxonomy_term_data}.tid of the term.',
|
|
),
|
|
'parent' => array(
|
|
'type' => 'int',
|
|
'unsigned' => TRUE,
|
|
'not null' => TRUE,
|
|
'default' => 0,
|
|
'description' => "Primary Key: The {taxonomy_term_data}.tid of the term's parent. 0 indicates no parent.",
|
|
),
|
|
),
|
|
'indexes' => array(
|
|
'parent' => array('parent'),
|
|
),
|
|
'foreign keys' => array(
|
|
'taxonomy_term_data' => array(
|
|
'table' => 'taxonomy_term_data',
|
|
'columns' => array('tid' => 'tid'),
|
|
),
|
|
),
|
|
'primary key' => array('tid', 'parent'),
|
|
);
|
|
|
|
$schema['taxonomy_index'] = array(
|
|
'description' => 'Maintains denormalized information about node/term relationships.',
|
|
'fields' => array(
|
|
'nid' => array(
|
|
'description' => 'The {node}.nid this record tracks.',
|
|
'type' => 'int',
|
|
'unsigned' => TRUE,
|
|
'not null' => TRUE,
|
|
'default' => 0,
|
|
),
|
|
'tid' => array(
|
|
'description' => 'The term ID.',
|
|
'type' => 'int',
|
|
'unsigned' => TRUE,
|
|
'not null' => TRUE,
|
|
'default' => 0,
|
|
),
|
|
'sticky' => array(
|
|
'description' => 'Boolean indicating whether the node is sticky.',
|
|
'type' => 'int',
|
|
'not null' => FALSE,
|
|
'default' => 0,
|
|
'size' => 'tiny',
|
|
),
|
|
'created' => array(
|
|
'description' => 'The Unix timestamp when the node was created.',
|
|
'type' => 'int',
|
|
'not null' => TRUE,
|
|
'default'=> 0,
|
|
),
|
|
),
|
|
'indexes' => array(
|
|
'term_node' => array('tid', 'sticky', 'created'),
|
|
'nid' => array('nid'),
|
|
),
|
|
'foreign keys' => array(
|
|
'tracked_node' => array(
|
|
'table' => 'node',
|
|
'columns' => array('nid' => 'nid'),
|
|
),
|
|
'term' => array(
|
|
'table' => 'taxonomy_term_data',
|
|
'columns' => array('tid' => 'tid'),
|
|
),
|
|
),
|
|
);
|
|
|
|
return $schema;
|
|
}
|