node.install 12 KB
Newer Older
1
2
3
4
5
6
7
8
<?php
// $Id$

/**
 * Implementation of hook_schema().
 */
function node_schema() {
  $schema['node'] = array(
9
    'description' => t('The base table for nodes.'),
10
    'fields' => array(
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
      'nid' => array(
        'description' => t('The primary identifier for a node.'),
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE),
      'vid' => array(
        'description' => t('The current {node_revisions}.vid version identifier.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0),
      'type' => array(
        'description' => t('The {node_type} of this node.'),
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => ''),
      'language' => array(
        'description' => t('The {languages}.language of this node.'),
        'type' => 'varchar',
        'length' => 12,
        'not null' => TRUE,
        'default' => ''),
      'title' => array(
        'description' => t('The title of this node, always treated a non-markup plain text.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => ''),
      'uid' => array(
        'description' => t('The {users}.uid that owns this node; initially, this is the user that created it.'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0),
      'status' => array(
        'description' => t('Boolean indicating whether the node is published (visible to non-administrators).'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 1),
      'created' => array(
        'description' => t('The Unix timestamp when the node was created.'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0),
      'changed' => array(
        'description' => t('The Unix timestamp when the node was most recently saved.'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0),
      'comment' => array(
        'description' => t('Whether comments are allowed on this node: 0 = no, 1 = read only, 2 = read/write.'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0),
      'promote' => array(
        'description' => t('Boolean indicating whether the node should displayed on the front page.'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0),
      'moderate' => array(
        'description' => t('Previously, a boolean indicating whether the node was "in moderation"; mostly no longer used.'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0),
      'sticky' => array(
        'description' => t('Boolean indicating whether the node should be displayed at the top of lists in which it appears.'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0),
      'tnid' => array(
        'description' => t('The translation set id for this node, which equals the node id of the source post in each set.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0),
      'translate' => array(
        'description' => t('A boolean indicating whether this translation page needs to be updated.'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0),
      ),
92
93
94
95
96
97
98
99
100
101
102
103
    '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'),
104
      ),
105
106
107
    'unique keys' => array(
      'nid_vid' => array('nid', 'vid'),
      'vid'     => array('vid')
108
      ),
109
    'primary key' => array('nid'),
110
    );
111
112

  $schema['node_access'] = array(
113
    'description' => t('Identifies which realm/grant pairs a user must possess in order to view, update, or delete specific nodes.'),
114
    'fields' => array(
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
      'nid' => array(
        'description' => t('The {node}.nid this record affects.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0),
      'gid' => array(
        'description' => t("The grant ID a user must possess in the specified realm to gain this row's privileges on the node."),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0),
      'realm' => array(
        'description' => t('The realm in which the user must possess the grant ID. Each node access node can define one or more realms.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => ''),
      'grant_view' => array(
        'description' => t('Boolean indicating whether a user with the realm/grant pair can view this node.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny'),
      'grant_update' => array(
        'description' => t('Boolean indicating whether a user with the realm/grant pair can edit this node.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny'),
      'grant_delete' => array(
        'description' => t('Boolean indicating whether a user with the realm/grant pair can delete this node.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny')
      ),
    'primary key' => array('nid', 'gid', 'realm'),
    );
157
158

  $schema['node_counter'] = array(
159
    'description' => t('Access statistics for {node}s.'),
160
    'fields' => array(
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
      'nid' => array(
        'description' => t('The {node}.nid for these statistics.'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0),
      'totalcount' => array(
        'description' => t('The total number of times the {node} has been viewed.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'size' => 'big'),
      'daycount' => array(
        'description' => t('The total number of times the {node} has been viewed today.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'size' => 'medium'),
      'timestamp' => array(
        'description' => t('The most recent time the {node} has been viewed.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0)
      ),
187
    'primary key' => array('nid'),
188
    );
189
190

  $schema['node_revisions'] = array(
191
    'description' => t('Stores information about each saved version of a {node}.'),
192
    'fields' => array(
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
      'nid' => array(
        'description' => t('The {node} this version belongs to.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0),
      'vid' => array(
        'description' => t('The primary identifier for this version.'),
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE),
      'uid' => array(
        'description' => t('The {users}.uid that created this version.'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0),
      'title' => array(
        'description' => t('The title of this version.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => ''),
      'body' => array(
        'description' => t('The body of this version.'),
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'big'),
      'teaser' => array(
        'description' => t('The teaser of this version.'),
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'big'),
      'log' => array(
        'description' => t('The log entry explaining the changes in this version.'),
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'big'),
      'timestamp' => array(
        'description' => t('A Unix timestamp indicating when this version was created.'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0),
      'format' => array(
        'description' => t("The input format used by this version's body."),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0)
      ),
241
242
243
    'indexes' => array(
      'nid' => array('nid'),
      'uid' => array('uid')
244
      ),
245
    'primary key' => array('vid'),
246
    );
247
248

  $schema['node_type'] = array(
249
    'description' => t('Stores information about all defined {node} types.'),
250
    'fields' => array(
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
      'type' => array(
        'description' => t('The machine-readable name of this type.'),
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE),
      'name' => array(
        'description' => t('The human-readable name of this type.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => ''),
      'module' => array(
        'description' => t('The module that implements this type.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE),
      'description'    => array(
        'description' => t('A brief description of this type.'),
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'medium'),
      'help' => array(
        'description' => t('Help information shown to the user when creating a {node} of this type.'),
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'medium'),
      'has_title' => array(
        'description' => t('Boolean indicating whether this type uses the {node}.title field.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'size' => 'tiny'),
      'title_label' => array(
        'description' => t('The label displayed for the title field on the edit form.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => ''),
      'has_body' => array(
        'description' => t('Boolean indicating whether this type uses the {node}.body field.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'size' => 'tiny'),
      'body_label' => array(
        'description' => t('The label displayed for the body field on the edit form.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => ''),
      'min_word_count' => array(
        'description' => t('The minimum number of words the body must contain.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'size' => 'small'),
      'custom' => array(
        '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).'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny'),
      'modified' => array(
        'description' => t('A boolean indicating whether this type has been modified by an administrator; currently not used in any way.'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny'),
      'locked' => array(
        'description' => t('A boolean indicating whether the administrator can change the machine name of this type.'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny'),
      'orig_type' => array(
        '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.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '')
      ),
332
    'primary key' => array('type'),
333
    );
334
335
336
337

  return $schema;
}