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