annotate modules/node/node.install @ 20:e3d20ebd63d1 tip

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