taxonomy.install

Archivo

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

Functions

Nombreorden descendente Descripción
taxonomy_schema Implementation of hook_schema().