summaryrefslogtreecommitdiff
path: root/modules/node/node.schema
blob: 34e77b325c3eef7b6cd75bf1575c1ac50410fdbe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php
// $Id$

function node_schema() {
  $schema['node'] = array(
    'fields' => array(
      'nid'       => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE),
      'vid'       => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
      'type'      => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''),
      'language'  => array('type' => 'varchar', 'length' => 12, 'not null' => TRUE, 'default' => ''),
      'title'     => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
      'uid'       => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
      'status'    => array('type' => 'int', 'not null' => TRUE, 'default' => 1),
      'created'   => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
      'changed'   => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
      'comment'   => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
      'promote'   => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
      'moderate'  => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
      'sticky'    => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
      'tnid'      => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
      'translate' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
    ),
    'indexes' => array(
      'node_changed'        => array('changed'),
      'node_created'        => array('created'),
      'node_moderate'       => array('moderate'),
      'node_promote_status' => array('promote', 'status'),
      'node_status_type'    => array('status', 'type', 'nid'),
      'node_title_type'     => array('title', array('type', 4)),
      'node_type'           => array(array('type', 4)),
      'status'              => array('status'),
      'uid'                 => array('uid'),
      'tnid'                => array('tnid'),
      'translate'           => array('translate'),
    ),
    'unique keys' => array(
      'nid_vid' => array('nid', 'vid'),
      'vid'     => array('vid')
    ),
    'primary key' => array('nid'),
  );

  $schema['node_access'] = array(
    'fields' => array(
      'nid'          => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
      'gid'          => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
      'realm'        => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
      'grant_view'   => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'size' => 'tiny'),
      'grant_update' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'size' => 'tiny'),
      'grant_delete' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'size' => 'tiny')
    ),
    'primary key' => array(
      'nid',
      'gid',
      'realm'
    ),
  );

  $schema['node_counter'] = array(
    'fields' => array(
      'nid'        => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
      'totalcount' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'size' => 'big'),
      'daycount'   => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'size' => 'medium'),
      'timestamp'  => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0)
    ),
    'primary key' => array('nid'),
  );

  $schema['node_revisions'] = array(
    'fields' => array(
      'nid'       => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
      'vid'       => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE),
      'uid'       => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
      'title'     => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
      'body'      => array('type' => 'text', 'not null' => TRUE, 'size' => 'big'),
      'teaser'    => array('type' => 'text', 'not null' => TRUE, 'size' => 'big'),
      'log'       => array('type' => 'text', 'not null' => TRUE, 'size' => 'big'),
      'timestamp' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
      'format'    => array('type' => 'int', 'not null' => TRUE, 'default' => 0)
    ),
    'indexes' => array(
      'nid' => array('nid'),
      'uid' => array('uid')
    ),
    'primary key' => array('vid'),
  );

  $schema['node_type'] = array(
    'fields' => array(
      'type'           => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE),
      'name'           => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
      'module'         => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE),
      'description'    => array('type' => 'text', 'not null' => TRUE, 'size' => 'medium'),
      'help'           => array('type' => 'text', 'not null' => TRUE, 'size' => 'medium'),
      'has_title'      => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'size' => 'tiny'),
      'title_label'    => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
      'has_body'       => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'size' => 'tiny'),
      'body_label'     => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
      'min_word_count' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'size' => 'small'),
      'custom'         => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny'),
      'modified'       => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny'),
      'locked'         => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny'),
      'orig_type'      => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '')
    ),
    'primary key' => array('type'),
  );

  return $schema;
}