[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/modules/taxonomy/ -> taxonomy.install (source)

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


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7