/[drupal]/contributions/modules/cvslog/cvs.install
ViewVC logotype

Contents of /contributions/modules/cvslog/cvs.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.18 - (show annotations) (download) (as text)
Tue May 5 17:15:31 2009 UTC (6 months, 3 weeks ago) by dww
Branch: MAIN
CVS Tags: HEAD
Changes since 1.17: +47 -1 lines
File MIME type: text/x-php
#371969 by dww: Moved developer info into a block provided by cvs.module.
1 <?php
2 // $Id: cvs.install,v 1.17 2009/04/11 23:48:28 dww Exp $
3
4
5 /**
6 * Implementation of hook_schema().
7 */
8 function cvs_schema() {
9 $schema['cvs_accounts'] = array(
10 'description' => t('Data about all CVS account holders on the site.'),
11 'fields' => array(
12 'uid' => array(
13 'description' => t('Foreign key: {users}.uid of the user for this CVS account.'),
14 'type' => 'int',
15 'unsigned' => TRUE,
16 'not null' => TRUE,
17 'default' => 0,
18 ),
19 'cvs_user' => array(
20 'description' => t('The CVS username of this account (not necessarily the same as {users}.name).'),
21 'type' => 'varchar',
22 'length' => 64,
23 'not null' => TRUE,
24 'default' => '',
25 ),
26 'pass' => array(
27 'description' => t('TODO'),
28 'type' => 'varchar',
29 'length' => 64,
30 'not null' => TRUE,
31 'default' => '',
32 ),
33 'motivation' => array(
34 'description' => t('TODO'),
35 'type' => 'text',
36 'not null' => FALSE,
37 ),
38 'status' => array(
39 'description' => t('TODO'),
40 'type' => 'int',
41 'not null' => TRUE,
42 'default' => 0,
43 ),
44 ),
45 'primary key' => array('cvs_user'),
46 'indexes' => array(
47 'uid' => array('uid'),
48 ),
49 );
50
51 $schema['cvs_files'] = array(
52 'description' => t('Data about each file included in each CVS commit.'),
53 'fields' => array(
54 'cid' => array(
55 'description' => t('Foreign key: {cvs_messages}.cid of the commit'),
56 'type' => 'int',
57 'unsigned' => TRUE,
58 'not null' => TRUE,
59 'default' => 0,
60 ),
61 'rid' => array(
62 'description' => t('Foreign key: {cvs_repositories}.rid of the repository for the commit.'),
63 'type' => 'int',
64 'unsigned' => TRUE,
65 'not null' => TRUE,
66 'default' => 0,
67 ),
68 'uid' => array(
69 'description' => t('Foreign key: {cvs_accounts}.uid of the user who did the commit.'),
70 'type' => 'int',
71 'unsigned' => TRUE,
72 'not null' => TRUE,
73 'default' => 0,
74 ),
75 'nid' => array(
76 'description' => t('Foreign key: {project_projects}.nid of the project that the commit belongs to (based on the directory of the commit).'),
77 'type' => 'int',
78 'unsigned' => TRUE,
79 'not null' => TRUE,
80 'default' => 0,
81 ),
82 'file' => array(
83 'description' => t('Path of the committed file, relative to the CVS module root for the given repository.'),
84 'type' => 'varchar',
85 'length' => 255,
86 'not null' => TRUE,
87 'default' => '',
88 ),
89 'branch' => array(
90 'description' => t('CVS branch that the file was committed to.'),
91 'type' => 'varchar',
92 'length' => 255,
93 'not null' => TRUE,
94 'default' => '',
95 ),
96 'revision' => array(
97 'description' => t('CVS revision ID of this file after the commit.'),
98 'type' => 'varchar',
99 'length' => 255,
100 'not null' => TRUE,
101 'default' => '',
102 ),
103 'lines_added' => array(
104 'description' => t('Number of lines added to this file by this commit.'),
105 'type' => 'int',
106 'unsigned' => TRUE,
107 'not null' => TRUE,
108 'default' => 0,
109 ),
110 'lines_removed' => array(
111 'description' => t('Number of lines removed from this file by this commit.'),
112 'type' => 'int',
113 'unsigned' => TRUE,
114 'not null' => TRUE,
115 'default' => 0,
116 ),
117 ),
118 'indexes' => array(
119 'cid' => array('cid'),
120 'nid' => array('nid'),
121 'rid' => array('rid'),
122 'uid' => array('uid'),
123 'file' => array('file'),
124 'branch' => array('branch'),
125 ),
126 );
127
128 $schema['cvs_messages'] = array(
129 'description' => t('Information about each CVS commit.'),
130 'fields' => array(
131 'cid' => array(
132 'description' => t('Primary key: CVS commit ID'),
133 'type' => 'serial',
134 'size' => 'normal',
135 'unsigned' => TRUE,
136 'not null' => TRUE,
137 ),
138 'rid' => array(
139 'description' => t('Foreign key: {cvs_repositories}.rid this commit went into.'),
140 'type' => 'int',
141 'unsigned' => TRUE,
142 'not null' => TRUE,
143 'default' => 0,
144 ),
145 'uid' => array(
146 'description' => t('Foreign key: {cvs_accounts}.uid that performed the commit, if the cvs_user has a corresponding Drupal user account.'),
147 'type' => 'int',
148 'unsigned' => TRUE,
149 'not null' => TRUE,
150 'default' => 0,
151 ),
152 'created' => array(
153 'description' => t('Timestamp when the commit was created.'),
154 'type' => 'int',
155 'unsigned' => TRUE,
156 'not null' => TRUE,
157 'default' => 0,
158 ),
159 'cvs_user' => array(
160 'description' => t('CVS username that performed the commit.'),
161 'type' => 'varchar',
162 'length' => 255,
163 'not null' => TRUE,
164 'default' => '',
165 ),
166 'message' => array(
167 'description' => t('The CVS commit message.'),
168 'type' => 'text',
169 'not null' => FALSE,
170 ),
171 ),
172 'primary key' => array('cid'),
173 'indexes' => array(
174 'uid' => array('uid'),
175 'created' => array('created'),
176 'rid' => array('rid'),
177 ),
178 );
179
180 $schema['cvs_projects'] = array(
181 'description' => t('CVS-related settings for each project node.'),
182 'fields' => array(
183 'nid' => array(
184 'description' => t('Foreign key: {project_projects}.nid'),
185 'type' => 'int',
186 'unsigned' => TRUE,
187 'not null' => TRUE,
188 'default' => 0,
189 ),
190 'rid' => array(
191 'description' => t('Foreign key: {cvs_repositories}.rid of the repository that this project is associated with.'),
192 'type' => 'int',
193 'unsigned' => TRUE,
194 'not null' => TRUE,
195 'default' => 0,
196 ),
197 'directory' => array(
198 'description' => t('The directory within the CVS repository that this project uses.'),
199 'type' => 'varchar',
200 'length' => 255,
201 'not null' => TRUE,
202 'default' => '',
203 ),
204 ),
205 'primary key' => array('nid'),
206 'indexes' => array(
207 'directory' => array('directory'),
208 ),
209
210 );
211
212 $schema['cvs_tags'] = array(
213 'description' => t('Data about all CVS tags and which project they belong to.'),
214 'fields' => array(
215 'nid' => array(
216 'description' => t('Foreign key: {project_projects}.nid of the project the tag belongs to.'),
217 'type' => 'int',
218 'unsigned' => TRUE,
219 'not null' => TRUE,
220 'default' => 0,
221 ),
222 'tag' => array(
223 'description' => t('The name of the branch or tag'),
224 'type' => 'varchar',
225 'length' => 255,
226 'not null' => TRUE,
227 'default' => '',
228 ),
229 'branch' => array(
230 'description' => t('Boolean indicating if the given CVS tag is a branch tag or a regular tag, 1 if it is a branch, 0 if not.'),
231 'type' => 'int',
232 'size' => 'tiny',
233 'unsigned' => TRUE,
234 'not null' => TRUE,
235 'default' => 0,
236 ),
237 'timestamp' => array(
238 'description' => t('The UNIX epoch timestamp when the branch or tag was created.'),
239 'type' => 'int',
240 'unsigned' => TRUE,
241 'not null' => TRUE,
242 'default' => 0,
243 ),
244 ),
245 'primary key' => array('nid', 'tag'),
246 'indexes' => array(
247 'tag' => array('tag'),
248 ),
249 );
250
251 $schema['cvs_project_maintainers'] = array(
252 'description' => t('Users who have CVS write access to a given project.'),
253 'fields' => array(
254 'nid' => array(
255 'description' => t('Foreign key: {project_projects}.nid of the project.'),
256 'type' => 'int',
257 'unsigned' => TRUE,
258 'not null' => TRUE,
259 'default' => 0,
260 ),
261 'uid' => array(
262 'description' => t('Foreign key: {cvs_accounts}.uid of a CVS account holder who has write access.'),
263 'type' => 'int',
264 'unsigned' => TRUE,
265 'not null' => TRUE,
266 'default' => 0,
267 ),
268 ),
269 'primary key' => array('nid', 'uid'),
270 );
271
272 $schema['cvs_repositories'] = array(
273 'description' => t('Data about each CVS repository associated with the site.'),
274 'fields' => array(
275 'rid' => array(
276 'description' => t('Primary key: Repository ID'),
277 'type' => 'serial',
278 'size' => 'normal',
279 'unsigned' => TRUE,
280 'not null' => TRUE,
281 ),
282 'name' => array(
283 'description' => t('Human-readable name of the repository'),
284 'type' => 'varchar',
285 'length' => 255,
286 'not null' => TRUE,
287 'default' => '',
288 ),
289 'root' => array(
290 'description' => t("The CVS root string to connect to the repository, for example ':pserver:pass:user@host:/directory'"),
291 'type' => 'varchar',
292 'length' => 255,
293 'not null' => TRUE,
294 'default' => '',
295 ),
296 'modules' => array(
297 'description' => t('The CVS module to use inside this repository'),
298 'type' => 'varchar',
299 'length' => 255,
300 'not null' => TRUE,
301 'default' => '',
302 ),
303 'diffurl' => array(
304 'description' => t('TODO'),
305 'type' => 'varchar',
306 'length' => 255,
307 'not null' => TRUE,
308 'default' => '',
309 ),
310 'newurl' => array(
311 'description' => t('TODO'),
312 'type' => 'varchar',
313 'length' => 255,
314 'not null' => TRUE,
315 'default' => '',
316 ),
317 'trackerurl' => array(
318 'description' => t('TODO'),
319 'type' => 'varchar',
320 'length' => 255,
321 'not null' => TRUE,
322 'default' => '',
323 ),
324 'method' => array(
325 'description' => t('TODO'),
326 'type' => 'int',
327 'size' => 'tiny',
328 'unsigned' => TRUE,
329 'not null' => TRUE,
330 'default' => 0,
331 ),
332 'updated' => array(
333 'description' => t('TODO'),
334 'type' => 'int',
335 'unsigned' => TRUE,
336 'not null' => TRUE,
337 'default' => 0,
338 ),
339 ),
340 'primary key' => array('rid'),
341 'unique keys' => array(
342 'name' => array('name'),
343 ),
344 );
345
346 $schema['cvs_cache_block'] = array(
347 'description' => t('Cache for CVS-specific blocks that cannot rely on the normal block cache.'),
348 'fields' => array(
349 'cid' => array(
350 'description' => 'Primary Key: Unique cache ID.',
351 'type' => 'varchar',
352 'length' => 255,
353 'not null' => TRUE,
354 'default' => '',
355 ),
356 'data' => array(
357 'description' => 'A collection of data to cache.',
358 'type' => 'blob',
359 'not null' => FALSE,
360 'size' => 'big',
361 ),
362 ),
363 'primary key' => array('cid'),
364 );
365
366 return $schema;
367 }
368
369 /**
370 * Implementation of hook_install()
371 */
372 function cvs_install() {
373 // Create tables.
374 drupal_install_schema('cvs');
375
376 db_query("UPDATE {system} SET weight = 3 WHERE name = 'cvs'");
377 }
378
379 /**
380 * Implementation of hook_uninstall()
381 */
382 function cvs_uninstall() {
383 // Remove tables.
384 drupal_uninstall_schema('cvs');
385
386 // Remove variables.
387 $variables = array(
388 'cvs_email_address',
389 'cvs_use_file',
390 'cvs_default_repo',
391 'cvs_restrict_project_creation',
392 'cvs_directory_validate_by_type',
393 'cvs_validate_by_short_name',
394 'cvs_directory_validate_dir_root_by_case',
395 'cvs_list_per_page',
396 'cvs_message_anon',
397 'cvs_message_auth',
398 'cvs_motivation_description',
399 'cvs_received_email',
400 'cvs_new_application_email',
401 'cvs_approved_email',
402 'cvs_pending_email',
403 'cvs_declined_email',
404 'cvs_disabled_email',
405 'cvs_message_new_release_branch',
406 'cvs_message_new_release_tag',
407 'cvs_pager',
408 'cvs_project_maintainers_block_length',
409 );
410 $query = db_query("SELECT name FROM {variable} WHERE name LIKE 'cvs_directory_tid_%'");
411 while ($var = db_fetch_object($query)) {
412 $variables[] = $var->name;
413 }
414 foreach ($variables as $variable) {
415 variable_del($variable);
416 }
417 }
418
419 /**
420 * Convert {cvs_messages}.cid to type serial.
421 */
422 function cvs_update_6000() {
423 $ret = array();
424 db_drop_primary_key($ret, 'cvs_messages');
425 db_change_field($ret, 'cvs_messages', 'cid', 'cid',
426 array('type' => 'serial', 'not null' => TRUE, 'unsigned' => TRUE),
427 array('primary key' => array('cid')));
428 $ret[] = update_sql("DELETE FROM {sequences} WHERE name = 'cvs_messages_cid'");
429 return $ret;
430 }
431
432 /**
433 * Fix deltas for CVS blocks.
434 */
435 function cvs_update_6001() {
436 $ret = array();
437 $ret[] = update_sql("UPDATE {blocks} SET delta = 'cvs_site_active_developers' WHERE delta = '0' AND module = 'cvs'");
438 $ret[] = update_sql("UPDATE {blocks} SET delta = 'cvs_site_active_projects' WHERE delta = '1' AND module = 'cvs'");
439 return $ret;
440 }
441
442 /**
443 * Add the {cvs_cache_block} table for the CVS maintainers block.
444 */
445 function cvs_update_6002() {
446 $ret = array();
447 $table = array(
448 'fields' => array(
449 'cid' => array(
450 'type' => 'varchar',
451 'length' => 255,
452 'not null' => TRUE,
453 'default' => '',
454 ),
455 'data' => array(
456 'type' => 'blob',
457 'not null' => FALSE,
458 'size' => 'big',
459 ),
460 ),
461 'primary key' => array('cid'),
462 );
463 db_create_table($ret, 'cvs_cache_block', $table);
464 return $ret;
465 }
466

  ViewVC Help
Powered by ViewVC 1.1.2