1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
|
<?php
/**
* @file
* Install, update and uninstall functions for the taxonomy module.
*/
/**
* Implements hook_uninstall().
*/
function taxonomy_uninstall() {
// Remove variables.
variable_del('taxonomy_override_selector');
variable_del('taxonomy_terms_per_page_admin');
// Remove taxonomy_term bundles.
$vocabularies = db_query("SELECT machine_name FROM {taxonomy_vocabulary}")->fetchCol();
foreach ($vocabularies as $vocabulary) {
field_attach_delete_bundle('taxonomy_term', $vocabulary);
}
}
/**
* 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.',
),
'vid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The {taxonomy_vocabulary}.vid of the vocabulary to which the term is assigned.',
),
'name' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'The term name.',
'translatable' => TRUE,
),
'description' => array(
'type' => 'text',
'not null' => FALSE,
'size' => 'big',
'description' => 'A description of the term.',
'translatable' => TRUE,
),
'format' => array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'description' => 'The {filter_format}.format of the description.',
),
'weight' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'The weight of this term in relation to other terms.',
),
),
'primary key' => array('tid'),
'foreign keys' => array(
'vocabulary' => array(
'table' => 'taxonomy_vocabulary',
'columns' => array('vid' => 'vid'),
),
),
'indexes' => array(
'taxonomy_tree' => array('vid', 'weight', 'name'),
'vid_name' => array('vid', '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_vocabulary'] = array(
'description' => 'Stores vocabulary information.',
'fields' => array(
'vid' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'Primary Key: Unique vocabulary ID.',
),
'name' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'Name of the vocabulary.',
'translatable' => TRUE,
),
'machine_name' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'The vocabulary machine name.',
),
'description' => array(
'type' => 'text',
'not null' => FALSE,
'size' => 'big',
'description' => 'Description of the vocabulary.',
'translatable' => TRUE,
),
'hierarchy' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'size' => 'tiny',
'description' => 'The type of hierarchy allowed within the vocabulary. (0 = disabled, 1 = single, 2 = multiple)',
),
'weight' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'The weight of this vocabulary in relation to other vocabularies.',
),
),
'primary key' => array('vid'),
'indexes' => array(
'list' => array('weight', 'name'),
),
'unique keys' => array(
'machine_name' => array('machine_name'),
),
);
$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;
}
/**
* Implements hook_field_schema().
*/
function taxonomy_field_schema($field) {
return array(
'columns' => array(
'tid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
),
),
'indexes' => array(
'tid' => array('tid'),
),
'foreign keys' => array(
'tid' => array(
'table' => 'taxonomy_term_data',
'columns' => array('tid' => 'tid'),
),
),
);
}
/**
* Remove the {taxonomy_vocabulary}.module field.
*/
function taxonomy_update_8000() {
db_drop_field('taxonomy_vocabulary', 'module');
}
|