Code coverage for /20080809/modules/taxonomy/taxonomy.install

Line #Times calledCode
1
<?php
2
// $Id: taxonomy.install,v 1.7 2008/01/08 07:46:41 goba Exp $
3
4
/**
5
 * Implementation of hook_schema().
6
 */
780
function taxonomy_schema() {
877
  $schema['term_data'] = array(
977
    'description' => t('Stores term information.'),
10
    'fields' => array(
11
      'tid' => array(
1277
        'type' => 'serial',
1377
        'unsigned' => TRUE,
1477
        'not null' => TRUE,
1577
        'description' => t('Primary Key: Unique term ID.'),
1677
      ),
17
      'vid' => array(
1877
        'type' => 'int',
1977
        'unsigned' => TRUE,
2077
        'not null' => TRUE,
2177
        'default' => 0,
2277
        'description' => t('The {vocabulary}.vid of the vocabulary to which
the term is assigned.'),
2377
      ),
24
      'name' => array(
2577
        'type' => 'varchar',
2677
        'length' => 255,
2777
        'not null' => TRUE,
2877
        'default' => '',
2977
        'description' => t('The term name.'),
3077
      ),
31
      'description' => array(
3277
        'type' => 'text',
3377
        'not null' => FALSE,
3477
        'size' => 'big',
3577
        'description' => t('A description of the term.'),
3677
      ),
37
      'weight' => array(
3877
        'type' => 'int',
3977
        'not null' => TRUE,
4077
        'default' => 0,
4177
        'size' => 'tiny',
4277
        'description' => t('The weight of this term in relation to other
terms.'),
4377
      ),
4477
    ),
4577
    'primary key' => array('tid'),
46
    'indexes' => array(
4777
      'taxonomy_tree' => array('vid', 'weight', 'name'),
4877
      'vid_name' => array('vid', 'name'),
4977
    ),
50
  );
51
5277
  $schema['term_hierarchy'] = array(
5377
    'description' => t('Stores the hierarchical relationship between
terms.'),
54
    'fields' => array(
55
      'tid' => array(
5677
        'type' => 'int',
5777
        'unsigned' => TRUE,
5877
        'not null' => TRUE,
5977
        'default' => 0,
6077
        'description' => t('Primary Key: The {term_data}.tid of the
term.'),
6177
      ),
62
      'parent' => array(
6377
        'type' => 'int',
6477
        'unsigned' => TRUE,
6577
        'not null' => TRUE,
6677
        'default' => 0,
6777
        'description' => t("Primary Key: The {term_data}.tid of the term's
parent. 0 indicates no parent."),
6877
      ),
6977
    ),
70
    'indexes' => array(
7177
      'parent' => array('parent'),
7277
    ),
7377
    'primary key' => array('tid', 'parent'),
74
  );
75
7677
  $schema['term_node'] = array(
7777
    'description' => t('Stores the relationship of terms to nodes.'),
78
    'fields' => array(
79
      'nid' => array(
8077
        'type' => 'int',
8177
        'unsigned' => TRUE,
8277
        'not null' => TRUE,
8377
        'default' => 0,
8477
        'description' => t('Primary Key: The {node}.nid of the node.'),
8577
      ),
86
      'vid' => array(
8777
        'type' => 'int',
8877
        'unsigned' => TRUE,
8977
        'not null' => TRUE,
9077
        'default' => 0,
9177
        'description' => t('Primary Key: The {node}.vid of the node.'),
9277
      ),
93
      'tid' => array(
9477
        'type' => 'int',
9577
        'unsigned' => TRUE,
9677
        'not null' => TRUE,
9777
        'default' => 0,
9877
        'description' => t('Primary Key: The {term_data}.tid of a term
assigned to the node.'),
9977
      ),
10077
    ),
101
    'indexes' => array(
10277
      'vid' => array('vid'),
10377
      'nid' => array('nid'),
10477
    ),
10577
    'primary key' => array('tid', 'vid'),
106
  );
107
10877
  $schema['term_relation'] = array(
10977
    'description' => t('Stores non-hierarchical relationships between
terms.'),
110
    'fields' => array(
111
      'trid' => array(
11277
        'type' => 'serial',
11377
        'not null' => TRUE,
11477
        'description' => t('Primary Key: Unique term relation ID.'),
11577
      ),
116
      'tid1' => array(
11777
        'type' => 'int',
11877
        'unsigned' => TRUE,
11977
        'not null' => TRUE,
12077
        'default' => 0,
12177
        'description' => t('The {term_data}.tid of the first term in a
relationship.'),
12277
      ),
123
      'tid2' => array(
12477
        'type' => 'int',
12577
        'unsigned' => TRUE,
12677
        'not null' => TRUE,
12777
        'default' => 0,
12877
        'description' => t('The {term_data}.tid of the second term in a
relationship.'),
12977
      ),
13077
    ),
131
    'unique keys' => array(
13277
      'tid1_tid2' => array('tid1', 'tid2'),
13377
    ),
134
    'indexes' => array(
13577
      'tid2' => array('tid2'),
13677
    ),
13777
    'primary key' => array('trid'),
138
  );
139
14077
  $schema['term_synonym'] = array(
14177
    'description' => t('Stores term synonyms.'),
142
    'fields' => array(
143
      'tsid' => array(
14477
        'type' => 'serial',
14577
        'not null' => TRUE,
14677
        'description' => t('Primary Key: Unique term synonym ID.'),
14777
      ),
148
      'tid' => array(
14977
        'type' => 'int',
15077
        'unsigned' => TRUE,
15177
        'not null' => TRUE,
15277
        'default' => 0,
15377
        'description' => t('The {term_data}.tid of the term.'),
15477
      ),
155
      'name' => array(
15677
        'type' => 'varchar',
15777
        'length' => 255,
15877
        'not null' => TRUE,
15977
        'default' => '',
16077
        'description' => t('The name of the synonym.'),
16177
      ),
16277
    ),
163
    'indexes' => array(
16477
      'tid' => array('tid'),
16577
      'name_tid' => array('name', 'tid'),
16677
    ),
16777
    'primary key' => array('tsid'),
168
  );
169
17077
  $schema['vocabulary'] = array(
17177
    'description' => t('Stores vocabulary information.'),
172
    'fields' => array(
173
      'vid' => array(
17477
        'type' => 'serial',
17577
        'unsigned' => TRUE,
17677
        'not null' => TRUE,
17777
        'description' => t('Primary Key: Unique vocabulary ID.'),
17877
      ),
179
      'name' => array(
18077
        'type' => 'varchar',
18177
        'length' => 255,
18277
        'not null' => TRUE,
18377
        'default' => '',
18477
        'description' => t('Name of the vocabulary.'),
18577
      ),
186
      'description' => array(
18777
        'type' => 'text',
18877
        'not null' => FALSE,
18977
        'size' => 'big',
19077
        'description' => t('Description of the vocabulary.'),
19177
      ),
192
      'help' => array(
19377
        'type' => 'varchar',
19477
        'length' => 255,
19577
        'not null' => TRUE,
19677
        'default' => '',
19777
        'description' => t('Help text to display for the vocabulary.'),
19877
      ),
199
      'relations' => array(
20077
        'type' => 'int',
20177
        'unsigned' => TRUE,
20277
        'not null' => TRUE,
20377
        'default' => 0,
20477
        'size' => 'tiny',
20577
        'description' => t('Whether or not related terms are enabled within
the vocabulary. (0 = disabled, 1 = enabled)'),
20677
      ),
207
      'hierarchy' => array(
20877
        'type' => 'int',
20977
        'unsigned' => TRUE,
21077
        'not null' => TRUE,
21177
        'default' => 0,
21277
        'size' => 'tiny',
21377
        'description' => t('The type of hierarchy allowed within the
vocabulary. (0 = disabled, 1 = single, 2 = multiple)'),
21477
      ),
215
      'multiple' => array(
21677
        'type' => 'int',
21777
        'unsigned' => TRUE,
21877
        'not null' => TRUE,
21977
        'default' => 0,
22077
        'size' => 'tiny',
22177
        'description' => t('Whether or not multiple terms from this
vocabulary may be assigned to a node. (0 = disabled, 1 = enabled)'),
22277
      ),
223
      'required' => array(
22477
        'type' => 'int',
22577
        'unsigned' => TRUE,
22677
        'not null' => TRUE,
22777
        'default' => 0,
22877
        'size' => 'tiny',
22977
        'description' => t('Whether or not terms are required for nodes
using this vocabulary. (0 = disabled, 1 = enabled)'),
23077
      ),
231
      'tags' => array(
23277
        'type' => 'int',
23377
        'unsigned' => TRUE,
23477
        'not null' => TRUE,
23577
        'default' => 0,
23677
        'size' => 'tiny',
23777
        'description' => t('Whether or not free tagging is enabled for the
vocabulary. (0 = disabled, 1 = enabled)'),
23877
      ),
239
      'module' => array(
24077
        'type' => 'varchar',
24177
        'length' => 255,
24277
        'not null' => TRUE,
24377
        'default' => '',
24477
        'description' => t('The module which created the vocabulary.'),
24577
      ),
246
      'weight' => array(
24777
        'type' => 'int',
24877
        'not null' => TRUE,
24977
        'default' => 0,
25077
        'size' => 'tiny',
25177
        'description' => t('The weight of the vocabulary in relation to
other vocabularies.'),
25277
      ),
25377
    ),
25477
    'primary key' => array('vid'),
255
    'indexes' => array(
25677
      'list' => array('weight', 'name'),
25777
    ),
258
  );
259
26077
  $schema['vocabulary_node_types'] = array(
26177
    'description' => t('Stores which node types vocabularies may be used
with.'),
262
    'fields' => array(
263
      'vid' => array(
26477
        'type' => 'int',
26577
        'unsigned' => TRUE,
26677
        'not null' => TRUE,
26777
        'default' => 0,
26877
        'description' => t('Primary Key: the {vocabulary}.vid of the
vocabulary.'),
26977
      ),
270
      'type' => array(
27177
        'type' => 'varchar',
27277
        'length' => 32,
27377
        'not null' => TRUE,
27477
        'default' => '',
27577
        'description' => t('The {node}.type of the node type for which the
vocabulary may be used.'),
27677
      ),
27777
    ),
27877
    'primary key' => array('type', 'vid'),
279
    'indexes' => array(
28077
      'vid' => array('vid'),
28177
    ),
282
  );
283
28477
  return $schema;
2850
}
286
28780