annotate modules/taxonomy/taxonomy.install @ 1:c1f4ac30525a 6.0

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