Code coverage for /20081101/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
 */
712
function taxonomy_schema() {
8134
  $schema['term_data'] = array(
9134
    'description' => t('Stores term information.'),
10
    'fields' => array(
11
      'tid' => array(
12134
        'type' => 'serial',
13134
        'unsigned' => TRUE,
14134
        'not null' => TRUE,
15134
        'description' => t('Primary Key: Unique term ID.'),
16134
      ),
17
      'vid' => array(
18134
        'type' => 'int',
19134
        'unsigned' => TRUE,
20134
        'not null' => TRUE,
21134
        'default' => 0,
22134
        'description' => t('The {vocabulary}.vid of the vocabulary to which
the term is assigned.'),
23134
      ),
24
      'name' => array(
25134
        'type' => 'varchar',
26134
        'length' => 255,
27134
        'not null' => TRUE,
28134
        'default' => '',
29134
        'description' => t('The term name.'),
30134
      ),
31
      'description' => array(
32134
        'type' => 'text',
33134
        'not null' => FALSE,
34134
        'size' => 'big',
35134
        'description' => t('A description of the term.'),
36134
      ),
37
      'weight' => array(
38134
        'type' => 'int',
39134
        'not null' => TRUE,
40134
        'default' => 0,
41134
        'size' => 'tiny',
42134
        'description' => t('The weight of this term in relation to other
terms.'),
43134
      ),
44134
    ),
45134
    'primary key' => array('tid'),
46
    'indexes' => array(
47134
      'taxonomy_tree' => array('vid', 'weight', 'name'),
48134
      'vid_name' => array('vid', 'name'),
49134
    ),
50
  );
51
52134
  $schema['term_hierarchy'] = array(
53134
    'description' => t('Stores the hierarchical relationship between
terms.'),
54
    'fields' => array(
55
      'tid' => array(
56134
        'type' => 'int',
57134
        'unsigned' => TRUE,
58134
        'not null' => TRUE,
59134
        'default' => 0,
60134
        'description' => t('Primary Key: The {term_data}.tid of the
term.'),
61134
      ),
62
      'parent' => array(
63134
        'type' => 'int',
64134
        'unsigned' => TRUE,
65134
        'not null' => TRUE,
66134
        'default' => 0,
67134
        'description' => t("Primary Key: The {term_data}.tid of the term's
parent. 0 indicates no parent."),
68134
      ),
69134
    ),
70
    'indexes' => array(
71134
      'parent' => array('parent'),
72134
    ),
73134
    'primary key' => array('tid', 'parent'),
74
  );
75
76134
  $schema['term_node'] = array(
77134
    'description' => t('Stores the relationship of terms to nodes.'),
78
    'fields' => array(
79
      'nid' => array(
80134
        'type' => 'int',
81134
        'unsigned' => TRUE,
82134
        'not null' => TRUE,
83134
        'default' => 0,
84134
        'description' => t('Primary Key: The {node}.nid of the node.'),
85134
      ),
86
      'vid' => array(
87134
        'type' => 'int',
88134
        'unsigned' => TRUE,
89134
        'not null' => TRUE,
90134
        'default' => 0,
91134
        'description' => t('Primary Key: The {node}.vid of the node.'),
92134
      ),
93
      'tid' => array(
94134
        'type' => 'int',
95134
        'unsigned' => TRUE,
96134
        'not null' => TRUE,
97134
        'default' => 0,
98134
        'description' => t('Primary Key: The {term_data}.tid of a term
assigned to the node.'),
99134
      ),
100134
    ),
101
    'indexes' => array(
102134
      'vid' => array('vid'),
103134
      'nid' => array('nid'),
104134
    ),
105134
    'primary key' => array('tid', 'vid'),
106
  );
107
108134
  $schema['term_relation'] = array(
109134
    'description' => t('Stores non-hierarchical relationships between
terms.'),
110
    'fields' => array(
111
      'trid' => array(
112134
        'type' => 'serial',
113134
        'not null' => TRUE,
114134
        'description' => t('Primary Key: Unique term relation ID.'),
115134
      ),
116
      'tid1' => array(
117134
        'type' => 'int',
118134
        'unsigned' => TRUE,
119134
        'not null' => TRUE,
120134
        'default' => 0,
121134
        'description' => t('The {term_data}.tid of the first term in a
relationship.'),
122134
      ),
123
      'tid2' => array(
124134
        'type' => 'int',
125134
        'unsigned' => TRUE,
126134
        'not null' => TRUE,
127134
        'default' => 0,
128134
        'description' => t('The {term_data}.tid of the second term in a
relationship.'),
129134
      ),
130134
    ),
131
    'unique keys' => array(
132134
      'tid1_tid2' => array('tid1', 'tid2'),
133134
    ),
134
    'indexes' => array(
135134
      'tid2' => array('tid2'),
136134
    ),
137134
    'primary key' => array('trid'),
138
  );
139
140134
  $schema['term_synonym'] = array(
141134
    'description' => t('Stores term synonyms.'),
142
    'fields' => array(
143
      'tsid' => array(
144134
        'type' => 'serial',
145134
        'not null' => TRUE,
146134
        'description' => t('Primary Key: Unique term synonym ID.'),
147134
      ),
148
      'tid' => array(
149134
        'type' => 'int',
150134
        'unsigned' => TRUE,
151134
        'not null' => TRUE,
152134
        'default' => 0,
153134
        'description' => t('The {term_data}.tid of the term.'),
154134
      ),
155
      'name' => array(
156134
        'type' => 'varchar',
157134
        'length' => 255,
158134
        'not null' => TRUE,
159134
        'default' => '',
160134
        'description' => t('The name of the synonym.'),
161134
      ),
162134
    ),
163
    'indexes' => array(
164134
      'tid' => array('tid'),
165134
      'name_tid' => array('name', 'tid'),
166134
    ),
167134
    'primary key' => array('tsid'),
168
  );
169
170134
  $schema['vocabulary'] = array(
171134
    'description' => t('Stores vocabulary information.'),
172
    'fields' => array(
173
      'vid' => array(
174134
        'type' => 'serial',
175134
        'unsigned' => TRUE,
176134
        'not null' => TRUE,
177134
        'description' => t('Primary Key: Unique vocabulary ID.'),
178134
      ),
179
      'name' => array(
180134
        'type' => 'varchar',
181134
        'length' => 255,
182134
        'not null' => TRUE,
183134
        'default' => '',
184134
        'description' => t('Name of the vocabulary.'),
185134
      ),
186
      'description' => array(
187134
        'type' => 'text',
188134
        'not null' => FALSE,
189134
        'size' => 'big',
190134
        'description' => t('Description of the vocabulary.'),
191134
      ),
192
      'help' => array(
193134
        'type' => 'varchar',
194134
        'length' => 255,
195134
        'not null' => TRUE,
196134
        'default' => '',
197134
        'description' => t('Help text to display for the vocabulary.'),
198134
      ),
199
      'relations' => array(
200134
        'type' => 'int',
201134
        'unsigned' => TRUE,
202134
        'not null' => TRUE,
203134
        'default' => 0,
204134
        'size' => 'tiny',
205134
        'description' => t('Whether or not related terms are enabled within
the vocabulary. (0 = disabled, 1 = enabled)'),
206134
      ),
207
      'hierarchy' => array(
208134
        'type' => 'int',
209134
        'unsigned' => TRUE,
210134
        'not null' => TRUE,
211134
        'default' => 0,
212134
        'size' => 'tiny',
213134
        'description' => t('The type of hierarchy allowed within the
vocabulary. (0 = disabled, 1 = single, 2 = multiple)'),
214134
      ),
215
      'multiple' => array(
216134
        'type' => 'int',
217134
        'unsigned' => TRUE,
218134
        'not null' => TRUE,
219134
        'default' => 0,
220134
        'size' => 'tiny',
221134
        'description' => t('Whether or not multiple terms from this
vocabulary may be assigned to a node. (0 = disabled, 1 = enabled)'),
222134
      ),
223
      'required' => array(
224134
        'type' => 'int',
225134
        'unsigned' => TRUE,
226134
        'not null' => TRUE,
227134
        'default' => 0,
228134
        'size' => 'tiny',
229134
        'description' => t('Whether or not terms are required for nodes
using this vocabulary. (0 = disabled, 1 = enabled)'),
230134
      ),
231
      'tags' => array(
232134
        'type' => 'int',
233134
        'unsigned' => TRUE,
234134
        'not null' => TRUE,
235134
        'default' => 0,
236134
        'size' => 'tiny',
237134
        'description' => t('Whether or not free tagging is enabled for the
vocabulary. (0 = disabled, 1 = enabled)'),
238134
      ),
239
      'module' => array(
240134
        'type' => 'varchar',
241134
        'length' => 255,
242134
        'not null' => TRUE,
243134
        'default' => '',
244134
        'description' => t('The module which created the vocabulary.'),
245134
      ),
246
      'weight' => array(
247134
        'type' => 'int',
248134
        'not null' => TRUE,
249134
        'default' => 0,
250134
        'size' => 'tiny',
251134
        'description' => t('The weight of the vocabulary in relation to
other vocabularies.'),
252134
      ),
253134
    ),
254134
    'primary key' => array('vid'),
255
    'indexes' => array(
256134
      'list' => array('weight', 'name'),
257134
    ),
258
  );
259
260134
  $schema['vocabulary_node_types'] = array(
261134
    'description' => t('Stores which node types vocabularies may be used
with.'),
262
    'fields' => array(
263
      'vid' => array(
264134
        'type' => 'int',
265134
        'unsigned' => TRUE,
266134
        'not null' => TRUE,
267134
        'default' => 0,
268134
        'description' => t('Primary Key: the {vocabulary}.vid of the
vocabulary.'),
269134
      ),
270
      'type' => array(
271134
        'type' => 'varchar',
272134
        'length' => 32,
273134
        'not null' => TRUE,
274134
        'default' => '',
275134
        'description' => t('The {node}.type of the node type for which the
vocabulary may be used.'),
276134
      ),
277134
    ),
278134
    'primary key' => array('type', 'vid'),
279
    'indexes' => array(
280134
      'vid' => array('vid'),
281134
    ),
282
  );
283
284134
  return $schema;
2850
}
286
28712