Spike PHPCoverage Details: taxonomy.install

Line #FrequencySource Line
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  */
7 function taxonomy_schema() {
8   $schema['term_data'] = array(
91    'description' => t('Stores term information.'),
10     'fields' => array(
11       'tid' => array(
12         'type' => 'serial',
13         'unsigned' => TRUE,
14         'not null' => TRUE,
15         'description' => t('Primary Key: Unique term ID.'),
16       ),
17       'vid' => array(
18         'type' => 'int',
19         'unsigned' => TRUE,
20         'not null' => TRUE,
21         'default' => 0,
22         'description' => t('The {vocabulary}.vid of the vocabulary to which the term is assigned.'),
23       ),
24       'name' => array(
25         'type' => 'varchar',
26         'length' => 255,
27         'not null' => TRUE,
28         'default' => '',
29         'description' => t('The term name.'),
30       ),
31       'description' => array(
32         'type' => 'text',
33         'not null' => FALSE,
34         'size' => 'big',
35         'description' => t('A description of the term.'),
36       ),
37       'weight' => array(
38         'type' => 'int',
39         'not null' => TRUE,
40         'default' => 0,
41         'size' => 'tiny',
42         'description' => t('The weight of this term in relation to other terms.'),
43       ),
44     ),
45     'primary key' => array('tid'),
46     'indexes' => array(
47       'taxonomy_tree' => array('vid', 'weight', 'name'),
48       'vid_name' => array('vid', 'name'),
49     ),
50   );
51 
52   $schema['term_hierarchy'] = array(
531    'description' => t('Stores the hierarchical relationship between terms.'),
54     'fields' => array(
55       'tid' => array(
56         'type' => 'int',
57         'unsigned' => TRUE,
58         'not null' => TRUE,
59         'default' => 0,
60         'description' => t('Primary Key: The {term_data}.tid of the term.'),
61       ),
62       'parent' => array(
63         'type' => 'int',
64         'unsigned' => TRUE,
65         'not null' => TRUE,
66         'default' => 0,
67         'description' => t("Primary Key: The {term_data}.tid of the term's parent. 0 indicates no parent."),
68       ),
69     ),
70     'indexes' => array(
71       'parent' => array('parent'),
72     ),
73     'primary key' => array('tid', 'parent'),
74   );
75 
76   $schema['term_node'] = array(
771    'description' => t('Stores the relationship of terms to nodes.'),
78     'fields' => array(
79       'nid' => array(
80         'type' => 'int',
81         'unsigned' => TRUE,
82         'not null' => TRUE,
83         'default' => 0,
84         'description' => t('Primary Key: The {node}.nid of the node.'),
85       ),
86       'vid' => array(
87         'type' => 'int',
88         'unsigned' => TRUE,
89         'not null' => TRUE,
90         'default' => 0,
91         'description' => t('Primary Key: The {node}.vid of the node.'),
92       ),
93       'tid' => array(
94         'type' => 'int',
95         'unsigned' => TRUE,
96         'not null' => TRUE,
97         'default' => 0,
98         'description' => t('Primary Key: The {term_data}.tid of a term assigned to the node.'),
99       ),
100     ),
101     'indexes' => array(
102       'vid' => array('vid'),
103       'nid' => array('nid'),
104     ),
105     'primary key' => array('tid', 'vid'),
106   );
107 
108   $schema['term_relation'] = array(
1091    'description' => t('Stores non-hierarchical relationships between terms.'),
110     'fields' => array(
111       'trid' => array(
112         'type' => 'serial',
113         'not null' => TRUE,
114         'description' => t('Primary Key: Unique term relation ID.'),
115       ),
116       'tid1' => array(
117         'type' => 'int',
118         'unsigned' => TRUE,
119         'not null' => TRUE,
120         'default' => 0,
121         'description' => t('The {term_data}.tid of the first term in a relationship.'),
122       ),
123       'tid2' => array(
124         'type' => 'int',
125         'unsigned' => TRUE,
126         'not null' => TRUE,
127         'default' => 0,
128         'description' => t('The {term_data}.tid of the second term in a relationship.'),
129       ),
130     ),
131     'unique keys' => array(
132       'tid1_tid2' => array('tid1', 'tid2'),
133     ),
134     'indexes' => array(
135       'tid2' => array('tid2'),
136     ),
137     'primary key' => array('trid'),
138   );
139 
140   $schema['term_synonym'] = array(
1411    'description' => t('Stores term synonyms.'),
142     'fields' => array(
143       'tsid' => array(
144         'type' => 'serial',
145         'not null' => TRUE,
146         'description' => t('Primary Key: Unique term synonym ID.'),
147       ),
148       'tid' => array(
149         'type' => 'int',
150         'unsigned' => TRUE,
151         'not null' => TRUE,
152         'default' => 0,
153         'description' => t('The {term_data}.tid of the term.'),
154       ),
155       'name' => array(
156         'type' => 'varchar',
157         'length' => 255,
158         'not null' => TRUE,
159         'default' => '',
160         'description' => t('The name of the synonym.'),
161       ),
162     ),
163     'indexes' => array(
164       'tid' => array('tid'),
165       'name_tid' => array('name', 'tid'),
166     ),
167     'primary key' => array('tsid'),
168   );
169 
170   $schema['vocabulary'] = array(
1711    'description' => t('Stores vocabulary information.'),
172     'fields' => array(
173       'vid' => array(
174         'type' => 'serial',
175         'unsigned' => TRUE,
176         'not null' => TRUE,
177         'description' => t('Primary Key: Unique vocabulary ID.'),
178       ),
179       'name' => array(
180         'type' => 'varchar',
181         'length' => 255,
182         'not null' => TRUE,
183         'default' => '',
184         'description' => t('Name of the vocabulary.'),
185       ),
186       'description' => array(
187         'type' => 'text',
188         'not null' => FALSE,
189         'size' => 'big',
190         'description' => t('Description of the vocabulary.'),
191       ),
192       'help' => array(
193         'type' => 'varchar',
194         'length' => 255,
195         'not null' => TRUE,
196         'default' => '',
197         'description' => t('Help text to display for the vocabulary.'),
198       ),
199       'relations' => array(
200         'type' => 'int',
201         'unsigned' => TRUE,
202         'not null' => TRUE,
203         'default' => 0,
204         'size' => 'tiny',
205         'description' => t('Whether or not related terms are enabled within the vocabulary. (0 = disabled, 1 = enabled)'),
206       ),
207       'hierarchy' => array(
208         'type' => 'int',
209         'unsigned' => TRUE,
210         'not null' => TRUE,
211         'default' => 0,
212         'size' => 'tiny',
213         'description' => t('The type of hierarchy allowed within the vocabulary. (0 = disabled, 1 = single, 2 = multiple)'),
214       ),
215       'multiple' => array(
216         'type' => 'int',
217         'unsigned' => TRUE,
218         'not null' => TRUE,
219         'default' => 0,
220         'size' => 'tiny',
221         'description' => t('Whether or not multiple terms from this vocabulary may be assigned to a node. (0 = disabled, 1 = enabled)'),
222       ),
223       'required' => array(
224         'type' => 'int',
225         'unsigned' => TRUE,
226         'not null' => TRUE,
227         'default' => 0,
228         'size' => 'tiny',
229         'description' => t('Whether or not terms are required for nodes using this vocabulary. (0 = disabled, 1 = enabled)'),
230       ),
231       'tags' => array(
232         'type' => 'int',
233         'unsigned' => TRUE,
234         'not null' => TRUE,
235         'default' => 0,
236         'size' => 'tiny',
237         'description' => t('Whether or not free tagging is enabled for the vocabulary. (0 = disabled, 1 = enabled)'),
238       ),
239       'module' => array(
240         'type' => 'varchar',
241         'length' => 255,
242         'not null' => TRUE,
243         'default' => '',
244         'description' => t('The module which created the vocabulary.'),
245       ),
246       'weight' => array(
247         'type' => 'int',
248         'not null' => TRUE,
249         'default' => 0,
250         'size' => 'tiny',
251         'description' => t('The weight of the vocabulary in relation to other vocabularies.'),
252       ),
253     ),
254     'primary key' => array('vid'),
255     'indexes' => array(
256       'list' => array('weight', 'name'),
257     ),
258   );
259 
260   $schema['vocabulary_node_types'] = array(
2611    'description' => t('Stores which node types vocabularies may be used with.'),
262     'fields' => array(
263       'vid' => array(
264         'type' => 'int',
265         'unsigned' => TRUE,
266         'not null' => TRUE,
267         'default' => 0,
268         'description' => t('Primary Key: the {vocabulary}.vid of the vocabulary.'),
269       ),
270       'type' => array(
271         'type' => 'varchar',
272         'length' => 32,
273         'not null' => TRUE,
274         'default' => '',
275         'description' => t('The {node}.type of the node type for which the vocabulary may be used.'),
276       ),
277     ),
278     'primary key' => array('type', 'vid'),
279     'indexes' => array(
280       'vid' => array('vid'),
281     ),
282   );
283 
2841  return $schema;
285 }
286