node.install

You are here

  1. 7 modules/node/node.install
  2. 6 modules/node/node.install
  3. 8 core/modules/node/node.install

Functions

Namesort descending Description
node_schema Implementation of hook_schema().

File

modules/node/node.install
View source
  1. <?php
  2. /**
  3. * Implementation of hook_schema().
  4. */
  5. function node_schema() {
  6. $schema['node'] = array(
  7. 'description' => 'The base table for nodes.',
  8. 'fields' => array(
  9. 'nid' => array(
  10. 'description' => 'The primary identifier for a node.',
  11. 'type' => 'serial',
  12. 'unsigned' => TRUE,
  13. 'not null' => TRUE),
  14. 'vid' => array(
  15. 'description' => 'The current {node_revisions}.vid version identifier.',
  16. 'type' => 'int',
  17. 'unsigned' => TRUE,
  18. 'not null' => TRUE,
  19. 'default' => 0),
  20. 'type' => array(
  21. 'description' => 'The {node_type}.type of this node.',
  22. 'type' => 'varchar',
  23. 'length' => 32,
  24. 'not null' => TRUE,
  25. 'default' => ''),
  26. 'language' => array(
  27. 'description' => 'The {languages}.language of this node.',
  28. 'type' => 'varchar',
  29. 'length' => 12,
  30. 'not null' => TRUE,
  31. 'default' => ''),
  32. 'title' => array(
  33. 'description' => 'The title of this node, always treated as non-markup plain text.',
  34. 'type' => 'varchar',
  35. 'length' => 255,
  36. 'not null' => TRUE,
  37. 'default' => ''),
  38. 'uid' => array(
  39. 'description' => 'The {users}.uid that owns this node; initially, this is the user that created it.',
  40. 'type' => 'int',
  41. 'not null' => TRUE,
  42. 'default' => 0),
  43. 'status' => array(
  44. 'description' => 'Boolean indicating whether the node is published (visible to non-administrators).',
  45. 'type' => 'int',
  46. 'not null' => TRUE,
  47. 'default' => 1),
  48. 'created' => array(
  49. 'description' => 'The Unix timestamp when the node was created.',
  50. 'type' => 'int',
  51. 'not null' => TRUE,
  52. 'default' => 0),
  53. 'changed' => array(
  54. 'description' => 'The Unix timestamp when the node was most recently saved.',
  55. 'type' => 'int',
  56. 'not null' => TRUE,
  57. 'default' => 0),
  58. 'comment' => array(
  59. 'description' => 'Whether comments are allowed on this node: 0 = no, 1 = read only, 2 = read/write.',
  60. 'type' => 'int',
  61. 'not null' => TRUE,
  62. 'default' => 0),
  63. 'promote' => array(
  64. 'description' => 'Boolean indicating whether the node should be displayed on the front page.',
  65. 'type' => 'int',
  66. 'not null' => TRUE,
  67. 'default' => 0),
  68. 'moderate' => array(
  69. 'description' => 'Previously, a boolean indicating whether the node was "in moderation"; mostly no longer used.',
  70. 'type' => 'int',
  71. 'not null' => TRUE,
  72. 'default' => 0),
  73. 'sticky' => array(
  74. 'description' => 'Boolean indicating whether the node should be displayed at the top of lists in which it appears.',
  75. 'type' => 'int',
  76. 'not null' => TRUE,
  77. 'default' => 0),
  78. 'tnid' => array(
  79. 'description' => 'The translation set id for this node, which equals the node id of the source post in each set.',
  80. 'type' => 'int',
  81. 'unsigned' => TRUE,
  82. 'not null' => TRUE,
  83. 'default' => 0),
  84. 'translate' => array(
  85. 'description' => 'A boolean indicating whether this translation page needs to be updated.',
  86. 'type' => 'int',
  87. 'not null' => TRUE,
  88. 'default' => 0),
  89. ),
  90. 'indexes' => array(
  91. 'node_changed' => array('changed'),
  92. 'node_created' => array('created'),
  93. 'node_moderate' => array('moderate'),
  94. 'node_promote_status' => array('promote', 'status'),
  95. 'node_status_type' => array('status', 'type', 'nid'),
  96. 'node_title_type' => array('title', array('type', 4)),
  97. 'node_type' => array(array('type', 4)),
  98. 'uid' => array('uid'),
  99. 'tnid' => array('tnid'),
  100. 'translate' => array('translate'),
  101. ),
  102. 'unique keys' => array(
  103. 'vid' => array('vid')
  104. ),
  105. 'primary key' => array('nid'),
  106. );
  107. $schema['node_access'] = array(
  108. 'description' => 'Identifies which realm/grant pairs a user must possess in order to view, update, or delete specific nodes.',
  109. 'fields' => array(
  110. 'nid' => array(
  111. 'description' => 'The {node}.nid this record affects.',
  112. 'type' => 'int',
  113. 'unsigned' => TRUE,
  114. 'not null' => TRUE,
  115. 'default' => 0),
  116. 'gid' => array(
  117. 'description' => "The grant ID a user must possess in the specified realm to gain this row's privileges on the node.",
  118. 'type' => 'int',
  119. 'unsigned' => TRUE,
  120. 'not null' => TRUE,
  121. 'default' => 0),
  122. 'realm' => array(
  123. 'description' => 'The realm in which the user must possess the grant ID. Each node access node can define one or more realms.',
  124. 'type' => 'varchar',
  125. 'length' => 255,
  126. 'not null' => TRUE,
  127. 'default' => ''),
  128. 'grant_view' => array(
  129. 'description' => 'Boolean indicating whether a user with the realm/grant pair can view this node.',
  130. 'type' => 'int',
  131. 'unsigned' => TRUE,
  132. 'not null' => TRUE,
  133. 'default' => 0,
  134. 'size' => 'tiny'),
  135. 'grant_update' => array(
  136. 'description' => 'Boolean indicating whether a user with the realm/grant pair can edit this node.',
  137. 'type' => 'int',
  138. 'unsigned' => TRUE,
  139. 'not null' => TRUE,
  140. 'default' => 0,
  141. 'size' => 'tiny'),
  142. 'grant_delete' => array(
  143. 'description' => 'Boolean indicating whether a user with the realm/grant pair can delete this node.',
  144. 'type' => 'int',
  145. 'unsigned' => TRUE,
  146. 'not null' => TRUE,
  147. 'default' => 0,
  148. 'size' => 'tiny')
  149. ),
  150. 'primary key' => array('nid', 'gid', 'realm'),
  151. );
  152. $schema['node_counter'] = array(
  153. 'description' => 'Access statistics for {node}s.',
  154. 'fields' => array(
  155. 'nid' => array(
  156. 'description' => 'The {node}.nid for these statistics.',
  157. 'type' => 'int',
  158. 'not null' => TRUE,
  159. 'default' => 0),
  160. 'totalcount' => array(
  161. 'description' => 'The total number of times the {node} has been viewed.',
  162. 'type' => 'int',
  163. 'unsigned' => TRUE,
  164. 'not null' => TRUE,
  165. 'default' => 0,
  166. 'size' => 'big'),
  167. 'daycount' => array(
  168. 'description' => 'The total number of times the {node} has been viewed today.',
  169. 'type' => 'int',
  170. 'unsigned' => TRUE,
  171. 'not null' => TRUE,
  172. 'default' => 0,
  173. 'size' => 'medium'),
  174. 'timestamp' => array(
  175. 'description' => 'The most recent time the {node} has been viewed.',
  176. 'type' => 'int',
  177. 'unsigned' => TRUE,
  178. 'not null' => TRUE,
  179. 'default' => 0)
  180. ),
  181. 'primary key' => array('nid'),
  182. );
  183. $schema['node_revisions'] = array(
  184. 'description' => 'Stores information about each saved version of a {node}.',
  185. 'fields' => array(
  186. 'nid' => array(
  187. 'description' => 'The {node} this version belongs to.',
  188. 'type' => 'int',
  189. 'unsigned' => TRUE,
  190. 'not null' => TRUE,
  191. 'default' => 0),
  192. 'vid' => array(
  193. 'description' => 'The primary identifier for this version.',
  194. 'type' => 'serial',
  195. 'unsigned' => TRUE,
  196. 'not null' => TRUE),
  197. 'uid' => array(
  198. 'description' => 'The {users}.uid that created this version.',
  199. 'type' => 'int',
  200. 'not null' => TRUE,
  201. 'default' => 0),
  202. 'title' => array(
  203. 'description' => 'The title of this version.',
  204. 'type' => 'varchar',
  205. 'length' => 255,
  206. 'not null' => TRUE,
  207. 'default' => ''),
  208. 'body' => array(
  209. 'description' => 'The body of this version.',
  210. 'type' => 'text',
  211. 'not null' => TRUE,
  212. 'size' => 'big'),
  213. 'teaser' => array(
  214. 'description' => 'The teaser of this version.',
  215. 'type' => 'text',
  216. 'not null' => TRUE,
  217. 'size' => 'big'),
  218. 'log' => array(
  219. 'description' => 'The log entry explaining the changes in this version.',
  220. 'type' => 'text',
  221. 'not null' => TRUE,
  222. 'size' => 'big'),
  223. 'timestamp' => array(
  224. 'description' => 'A Unix timestamp indicating when this version was created.',
  225. 'type' => 'int',
  226. 'not null' => TRUE,
  227. 'default' => 0),
  228. 'format' => array(
  229. 'description' => "The input format used by this version's body.",
  230. 'type' => 'int',
  231. 'not null' => TRUE,
  232. 'default' => 0)
  233. ),
  234. 'indexes' => array(
  235. 'nid' => array('nid'),
  236. 'uid' => array('uid')
  237. ),
  238. 'primary key' => array('vid'),
  239. );
  240. $schema['node_type'] = array(
  241. 'description' => 'Stores information about all defined {node} types.',
  242. 'fields' => array(
  243. 'type' => array(
  244. 'description' => 'The machine-readable name of this type.',
  245. 'type' => 'varchar',
  246. 'length' => 32,
  247. 'not null' => TRUE),
  248. 'name' => array(
  249. 'description' => 'The human-readable name of this type.',
  250. 'type' => 'varchar',
  251. 'length' => 255,
  252. 'not null' => TRUE,
  253. 'default' => ''),
  254. 'module' => array(
  255. 'description' => 'The base string used to construct callbacks corresponding to this node type.',
  256. 'type' => 'varchar',
  257. 'length' => 255,
  258. 'not null' => TRUE),
  259. 'description' => array(
  260. 'description' => 'A brief description of this type.',
  261. 'type' => 'text',
  262. 'not null' => TRUE,
  263. 'size' => 'medium'),
  264. 'help' => array(
  265. 'description' => 'Help information shown to the user when creating a {node} of this type.',
  266. 'type' => 'text',
  267. 'not null' => TRUE,
  268. 'size' => 'medium'),
  269. 'has_title' => array(
  270. 'description' => 'Boolean indicating whether this type uses the {node}.title field.',
  271. 'type' => 'int',
  272. 'unsigned' => TRUE,
  273. 'not null' => TRUE,
  274. 'size' => 'tiny'),
  275. 'title_label' => array(
  276. 'description' => 'The label displayed for the title field on the edit form.',
  277. 'type' => 'varchar',
  278. 'length' => 255,
  279. 'not null' => TRUE,
  280. 'default' => ''),
  281. 'has_body' => array(
  282. 'description' => 'Boolean indicating whether this type uses the {node_revisions}.body field.',
  283. 'type' => 'int',
  284. 'unsigned' => TRUE,
  285. 'not null' => TRUE,
  286. 'size' => 'tiny'),
  287. 'body_label' => array(
  288. 'description' => 'The label displayed for the body field on the edit form.',
  289. 'type' => 'varchar',
  290. 'length' => 255,
  291. 'not null' => TRUE,
  292. 'default' => ''),
  293. 'min_word_count' => array(
  294. 'description' => 'The minimum number of words the body must contain.',
  295. 'type' => 'int',
  296. 'unsigned' => TRUE,
  297. 'not null' => TRUE,
  298. 'size' => 'small'),
  299. 'custom' => array(
  300. 'description' => 'A boolean indicating whether this type is defined by a module (FALSE) or by a user via a module like the Content Construction Kit (TRUE).',
  301. 'type' => 'int',
  302. 'not null' => TRUE,
  303. 'default' => 0,
  304. 'size' => 'tiny'),
  305. 'modified' => array(
  306. 'description' => 'A boolean indicating whether this type has been modified by an administrator; currently not used in any way.',
  307. 'type' => 'int',
  308. 'not null' => TRUE,
  309. 'default' => 0,
  310. 'size' => 'tiny'),
  311. 'locked' => array(
  312. 'description' => 'A boolean indicating whether the administrator can change the machine name of this type.',
  313. 'type' => 'int',
  314. 'not null' => TRUE,
  315. 'default' => 0,
  316. 'size' => 'tiny'),
  317. 'orig_type' => array(
  318. 'description' => 'The original machine-readable name of this node type. This may be different from the current type name if the locked field is 0.',
  319. 'type' => 'varchar',
  320. 'length' => 255,
  321. 'not null' => TRUE,
  322. 'default' => '')
  323. ),
  324. 'primary key' => array('type'),
  325. );
  326. return $schema;
  327. }