annotate modules/node/node.install @ 1:c1f4ac30525a 6.0

Drupal 6.0
author Franck Deroche <webmaster@defr.org>
date Tue, 23 Dec 2008 14:28:28 +0100
parents
children fff6d4c8c043
rev   line source
webmaster@1 1 <?php
webmaster@1 2 // $Id: node.install,v 1.4 2007/12/18 12:59:21 dries 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(
webmaster@1 9 'description' => t('The base table for nodes.'),
webmaster@1 10 'fields' => array(
webmaster@1 11 'nid' => array(
webmaster@1 12 'description' => t('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(
webmaster@1 17 'description' => t('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(
webmaster@1 23 'description' => t('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(
webmaster@1 29 'description' => t('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(
webmaster@1 35 'description' => t('The title of this node, always treated a 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(
webmaster@1 41 'description' => t('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(
webmaster@1 46 'description' => t('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(
webmaster@1 51 'description' => t('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(
webmaster@1 56 'description' => t('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(
webmaster@1 61 'description' => t('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(
webmaster@1 66 'description' => t('Boolean indicating whether the node should 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(
webmaster@1 71 'description' => t('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(
webmaster@1 76 'description' => t('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(
webmaster@1 81 'description' => t('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(
webmaster@1 87 'description' => t('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(
webmaster@1 111 'description' => t('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(
webmaster@1 114 'description' => t('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(
webmaster@1 120 'description' => t("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(
webmaster@1 126 'description' => t('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(
webmaster@1 132 'description' => t('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(
webmaster@1 139 'description' => t('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(
webmaster@1 146 'description' => t('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(
webmaster@1 157 'description' => t('Access statistics for {node}s.'),
webmaster@1 158 'fields' => array(
webmaster@1 159 'nid' => array(
webmaster@1 160 'description' => t('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(
webmaster@1 165 'description' => t('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(
webmaster@1 172 'description' => t('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(
webmaster@1 179 'description' => t('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(
webmaster@1 189 'description' => t('Stores information about each saved version of a {node}.'),
webmaster@1 190 'fields' => array(
webmaster@1 191 'nid' => array(
webmaster@1 192 'description' => t('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(
webmaster@1 198 'description' => t('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(
webmaster@1 203 'description' => t('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(
webmaster@1 208 'description' => t('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(
webmaster@1 214 'description' => t('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(
webmaster@1 219 'description' => t('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(
webmaster@1 224 'description' => t('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(
webmaster@1 229 'description' => t('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(
webmaster@1 234 'description' => t("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(
webmaster@1 247 'description' => t('Stores information about all defined {node} types.'),
webmaster@1 248 'fields' => array(
webmaster@1 249 'type' => array(
webmaster@1 250 'description' => t('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(
webmaster@1 255 'description' => t('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(
webmaster@1 261 'description' => t('The module that implements this type.'),
webmaster@1 262 'type' => 'varchar',
webmaster@1 263 'length' => 255,
webmaster@1 264 'not null' => TRUE),
webmaster@1 265 'description' => array(
webmaster@1 266 'description' => t('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(
webmaster@1 271 'description' => t('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(
webmaster@1 276 'description' => t('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(
webmaster@1 282 'description' => t('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(
webmaster@1 288 'description' => t('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(
webmaster@1 294 'description' => t('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(
webmaster@1 300 'description' => t('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(
webmaster@1 306 '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).'),
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(
webmaster@1 312 'description' => t('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(
webmaster@1 318 'description' => t('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(
webmaster@1 324 '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.'),
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