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