Code coverage for /20080809/modules/node/node.install

Line #Times calledCode
1
<?php
2
// $Id: node.install,v 1.6 2008/04/15 08:39:03 dries Exp $
3
4
/**
5
 * Implementation of hook_schema().
6
 */
780
function node_schema() {
877
  $schema['node'] = array(
977
    'description' => t('The base table for nodes.'),
10
    'fields' => array(
11
      'nid' => array(
1277
        'description' => t('The primary identifier for a node.'),
1377
        'type' => 'serial',
1477
        'unsigned' => TRUE,
1577
        'not null' => TRUE,
1677
      ),
17
      'vid' => array(
1877
        'description' => t('The current {node_revisions}.vid version
identifier.'),
1977
        'type' => 'int',
2077
        'unsigned' => TRUE,
2177
        'not null' => TRUE,
2277
        'default' => 0,
2377
      ),
24
      'type' => array(
2577
        'description' => t('The {node_type}.type of this node.'),
2677
        'type' => 'varchar',
2777
        'length' => 32,
2877
        'not null' => TRUE,
2977
        'default' => '',
3077
      ),
31
      'language' => array(
3277
        'description' => t('The {languages}.language of this node.'),
3377
        'type' => 'varchar',
3477
        'length' => 12,
3577
        'not null' => TRUE,
3677
        'default' => '',
3777
      ),
38
      'title' => array(
3977
        'description' => t('The title of this node, always treated as
non-markup plain text.'),
4077
        'type' => 'varchar',
4177
        'length' => 255,
4277
        'not null' => TRUE,
4377
        'default' => '',
4477
      ),
45
      'uid' => array(
4677
        'description' => t('The {users}.uid that owns this node; initially,
this is the user that created it.'),
4777
        'type' => 'int',
4877
        'not null' => TRUE,
4977
        'default' => 0,
5077
      ),
51
      'status' => array(
5277
        'description' => t('Boolean indicating whether the node is
published (visible to non-administrators).'),
5377
        'type' => 'int',
5477
        'not null' => TRUE,
5577
        'default' => 1,
5677
      ),
57
      'created' => array(
5877
        'description' => t('The Unix timestamp when the node was
created.'),
5977
        'type' => 'int',
6077
        'not null' => TRUE,
6177
        'default' => 0,
6277
      ),
63
      'changed' => array(
6477
        'description' => t('The Unix timestamp when the node was most
recently saved.'),
6577
        'type' => 'int',
6677
        'not null' => TRUE,
6777
        'default' => 0,
6877
      ),
69
      'comment' => array(
7077
        'description' => t('Whether comments are allowed on this node: 0 =
no, 1 = read only, 2 = read/write.'),
7177
        'type' => 'int',
7277
        'not null' => TRUE,
7377
        'default' => 0,
7477
      ),
75
      'promote' => array(
7677
        'description' => t('Boolean indicating whether the node should be
displayed on the front page.'),
7777
        'type' => 'int',
7877
        'not null' => TRUE,
7977
        'default' => 0,
8077
      ),
81
      'moderate' => array(
8277
        'description' => t('Previously, a boolean indicating whether the
node was "in moderation"; mostly no longer used.'),
8377
        'type' => 'int',
8477
        'not null' => TRUE,
8577
        'default' => 0,
8677
      ),
87
      'sticky' => array(
8877
        'description' => t('Boolean indicating whether the node should be
displayed at the top of lists in which it appears.'),
8977
        'type' => 'int',
9077
        'not null' => TRUE,
9177
        'default' => 0,
9277
      ),
93
      'tnid' => array(
9477
        'description' => t('The translation set id for this node, which
equals the node id of the source post in each set.'),
9577
        'type' => 'int',
9677
        'unsigned' => TRUE,
9777
        'not null' => TRUE,
9877
        'default' => 0,
9977
      ),
100
      'translate' => array(
10177
        'description' => t('A boolean indicating whether this translation
page needs to be updated.'),
10277
        'type' => 'int',
10377
        'not null' => TRUE,
10477
        'default' => 0,
10577
      ),
10677
    ),
107
    'indexes' => array(
10877
      'node_changed'        => array('changed'),
10977
      'node_created'        => array('created'),
11077
      'node_moderate'       => array('moderate'),
11177
      'node_promote_status' => array('promote', 'status'),
11277
      'node_status_type'    => array('status', 'type', 'nid'),
11377
      'node_title_type'     => array('title', array('type', 4)),
11477
      'node_type'           => array(array('type', 4)),
11577
      'uid'                 => array('uid'),
11677
      'tnid'                => array('tnid'),
11777
      'translate'           => array('translate'),
11877
    ),
119
    'unique keys' => array(
12077
      'vid' => array('vid'),
12177
    ),
12277
    'primary key' => array('nid'),
123
  );
124
12577
  $schema['node_access'] = array(
12677
    '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(
12977
        'description' => t('The {node}.nid this record affects.'),
13077
        'type' => 'int',
13177
        'unsigned' => TRUE,
13277
        'not null' => TRUE,
13377
        'default' => 0,
13477
      ),
135
      'gid' => array(
13677
        'description' => t("The grant ID a user must possess in the
specified realm to gain this row's privileges on the node."),
13777
        'type' => 'int',
13877
        'unsigned' => TRUE,
13977
        'not null' => TRUE,
14077
        'default' => 0,
14177
      ),
142
      'realm' => array(
14377
        'description' => t('The realm in which the user must possess the
grant ID. Each node access node can define one or more realms.'),
14477
        'type' => 'varchar',
14577
        'length' => 255,
14677
        'not null' => TRUE,
14777
        'default' => '',
14877
      ),
149
      'grant_view' => array(
15077
        'description' => t('Boolean indicating whether a user with the
realm/grant pair can view this node.'),
15177
        'type' => 'int',
15277
        'unsigned' => TRUE,
15377
        'not null' => TRUE,
15477
        'default' => 0,
15577
        'size' => 'tiny',
15677
      ),
157
      'grant_update' => array(
15877
        'description' => t('Boolean indicating whether a user with the
realm/grant pair can edit this node.'),
15977
        'type' => 'int',
16077
        'unsigned' => TRUE,
16177
        'not null' => TRUE,
16277
        'default' => 0,
16377
        'size' => 'tiny',
16477
      ),
165
      'grant_delete' => array(
16677
        'description' => t('Boolean indicating whether a user with the
realm/grant pair can delete this node.'),
16777
        'type' => 'int',
16877
        'unsigned' => TRUE,
16977
        'not null' => TRUE,
17077
        'default' => 0,
17177
        'size' => 'tiny',
17277
      ),
17377
    ),
17477
    'primary key' => array('nid', 'gid', 'realm'),
175
  );
176
17777
  $schema['node_counter'] = array(
17877
    'description' => t('Access statistics for {node}s.'),
179
    'fields' => array(
180
      'nid' => array(
18177
        'description' => t('The {node}.nid for these statistics.'),
18277
        'type' => 'int',
18377
        'not null' => TRUE,
18477
        'default' => 0,
18577
      ),
186
      'totalcount' => array(
18777
        'description' => t('The total number of times the {node} has been
viewed.'),
18877
        'type' => 'int',
18977
        'unsigned' => TRUE,
19077
        'not null' => TRUE,
19177
        'default' => 0,
19277
        'size' => 'big',
19377
      ),
194
      'daycount' => array(
19577
        'description' => t('The total number of times the {node} has been
viewed today.'),
19677
        'type' => 'int',
19777
        'unsigned' => TRUE,
19877
        'not null' => TRUE,
19977
        'default' => 0,
20077
        'size' => 'medium',
20177
      ),
202
      'timestamp' => array(
20377
        'description' => t('The most recent time the {node} has been
viewed.'),
20477
        'type' => 'int',
20577
        'unsigned' => TRUE,
20677
        'not null' => TRUE,
20777
        'default' => 0,
20877
      ),
20977
    ),
21077
    'primary key' => array('nid'),
211
  );
212
21377
  $schema['node_revisions'] = array(
21477
    'description' => t('Stores information about each saved version of a
{node}.'),
215
    'fields' => array(
216
      'nid' => array(
21777
        'description' => t('The {node} this version belongs to.'),
21877
        'type' => 'int',
21977
        'unsigned' => TRUE,
22077
        'not null' => TRUE,
22177
        'default' => 0,
22277
      ),
223
      'vid' => array(
22477
        'description' => t('The primary identifier for this version.'),
22577
        'type' => 'serial',
22677
        'unsigned' => TRUE,
22777
        'not null' => TRUE,
22877
      ),
229
      'uid' => array(
23077
        'description' => t('The {users}.uid that created this version.'),
23177
        'type' => 'int',
23277
        'not null' => TRUE,
23377
        'default' => 0,
23477
      ),
235
      'title' => array(
23677
        'description' => t('The title of this version.'),
23777
        'type' => 'varchar',
23877
        'length' => 255,
23977
        'not null' => TRUE,
24077
        'default' => '',
24177
      ),
242
      'body' => array(
24377
        'description' => t('The body of this version.'),
24477
        'type' => 'text',
24577
        'not null' => TRUE,
24677
        'size' => 'big',
24777
      ),
248
      'teaser' => array(
24977
        'description' => t('The teaser of this version.'),
25077
        'type' => 'text',
25177
        'not null' => TRUE,
25277
        'size' => 'big',
25377
      ),
254
      'log' => array(
25577
        'description' => t('The log entry explaining the changes in this
version.'),
25677
        'type' => 'text',
25777
        'not null' => TRUE,
25877
        'size' => 'big',
25977
      ),
260
      'timestamp' => array(
26177
        'description' => t('A Unix timestamp indicating when this version
was created.'),
26277
        'type' => 'int',
26377
        'not null' => TRUE,
26477
        'default' => 0,
26577
      ),
266
      'format' => array(
26777
        'description' => t("The input format used by this version's
body."),
26877
        'type' => 'int',
26977
        'not null' => TRUE,
27077
        'default' => 0,
27177
      ),
27277
    ),
273
    'indexes' => array(
27477
      'nid' => array('nid'),
27577
      'uid' => array('uid'),
27677
    ),
27777
    'primary key' => array('vid'),
278
  );
279
28077
  $schema['node_type'] = array(
28177
    'description' => t('Stores information about all defined {node}
types.'),
282
    'fields' => array(
283
      'type' => array(
28477
        'description' => t('The machine-readable name of this type.'),
28577
        'type' => 'varchar',
28677
        'length' => 32,
28777
        'not null' => TRUE,
28877
      ),
289
      'name' => array(
29077
        'description' => t('The human-readable name of this type.'),
29177
        'type' => 'varchar',
29277
        'length' => 255,
29377
        'not null' => TRUE,
29477
        'default' => '',
29577
      ),
296
      'module' => array(
29777
        'description' => t('The module that implements this type.'),
29877
        'type' => 'varchar',
29977
        'length' => 255,
30077
        'not null' => TRUE,
30177
      ),
302
      'description' => array(
30377
        'description' => t('A brief description of this type.'),
30477
        'type' => 'text',
30577
        'not null' => TRUE,
30677
        'size' => 'medium',
30777
      ),
308
      'help' => array(
30977
        'description' => t('Help information shown to the user when
creating a {node} of this type.'),
31077
        'type' => 'text',
31177
        'not null' => TRUE,
31277
        'size' => 'medium',
31377
      ),
314
      'has_title' => array(
31577
        'description' => t('Boolean indicating whether this type uses the
{node}.title field.'),
31677
        'type' => 'int',
31777
        'unsigned' => TRUE,
31877
        'not null' => TRUE,
31977
        'size' => 'tiny',
32077
      ),
321
      'title_label' => array(
32277
        'description' => t('The label displayed for the title field on the
edit form.'),
32377
        'type' => 'varchar',
32477
        'length' => 255,
32577
        'not null' => TRUE,
32677
        'default' => '',
32777
      ),
328
      'has_body' => array(
32977
        'description' => t('Boolean indicating whether this type uses the
{node_revisions}.body field.'),
33077
        'type' => 'int',
33177
        'unsigned' => TRUE,
33277
        'not null' => TRUE,
33377
        'size' => 'tiny',
33477
      ),
335
      'body_label' => array(
33677
        'description' => t('The label displayed for the body field on the
edit form.'),
33777
        'type' => 'varchar',
33877
        'length' => 255,
33977
        'not null' => TRUE,
34077
        'default' => '',
34177
      ),
342
      'min_word_count' => array(
34377
        'description' => t('The minimum number of words the body must
contain.'),
34477
        'type' => 'int',
34577
        'unsigned' => TRUE,
34677
        'not null' => TRUE,
34777
        'size' => 'small',
34877
      ),
349
      'custom' => array(
35077
        '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).'),
35177
        'type' => 'int',
35277
        'not null' => TRUE,
35377
        'default' => 0,
35477
        'size' => 'tiny',
35577
      ),
356
      'modified' => array(
35777
        'description' => t('A boolean indicating whether this type has been
modified by an administrator; currently not used in any way.'),
35877
        'type' => 'int',
35977
        'not null' => TRUE,
36077
        'default' => 0,
36177
        'size' => 'tiny',
36277
      ),
363
      'locked' => array(
36477
        'description' => t('A boolean indicating whether the administrator
can change the machine name of this type.'),
36577
        'type' => 'int',
36677
        'not null' => TRUE,
36777
        'default' => 0,
36877
        'size' => 'tiny',
36977
      ),
370
      'orig_type' => array(
37177
        '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.'),
37277
        'type' => 'varchar',
37377
        'length' => 255,
37477
        'not null' => TRUE,
37577
        'default' => '',
37677
      ),
37777
    ),
37877
    'primary key' => array('type'),
379
  );
380
38177
  return $schema;
3820
}
38380