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