/[drupal]/contributions/modules/journal/journal.install
ViewVC logotype

Contents of /contributions/modules/journal/journal.install

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


Revision 1.8 - (show annotations) (download) (as text)
Sun Jun 21 00:02:13 2009 UTC (5 months, 1 week ago) by sun
Branch: MAIN
Changes since 1.7: +6 -1 lines
File MIME type: text/x-php
#474422 by evoltech: Fixed journal entry not logged in forms using #tree = TRUE.
1 <?php
2 // $Id: journal.install,v 1.7 2008/11/03 23:17:50 sun Exp $
3
4 /**
5 * @file
6 * Installation functions for Journal module.
7 */
8
9 /**
10 * Implementation of hook_schema().
11 */
12 function journal_schema() {
13 $schema['journal'] = array(
14 'description' => t('Stores all journal entries.'),
15 'fields' => array(
16 'jid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE,
17 'description' => t('The primary identifier for a journal entry.'),
18 ),
19 'uid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0,
20 'description' => t('The user id of the author of a journal entry.'),
21 ),
22 'message' => array('type' => 'text', 'size' => 'big', 'not null' => TRUE,
23 'description' => t('The actual message of a journal entry.'),
24 ),
25 'location' => array('type' => 'text', 'not null' => TRUE,
26 'description' => t('The internal Drupal path to the form a journal entry was entered in.'),
27 ),
28 'timestamp' => array('type' => 'int', 'not null' => TRUE, 'default' => 0,
29 'description' => t('The UNIX timestamp when the journal entry was created.'),
30 ),
31 ),
32 'primary key' => array('jid'),
33 'indexes' => array(
34 'location' => array(array('location', 32)),
35 ),
36 );
37 $schema['journal_patch'] = array(
38 'description' => t('Stores all journal patch records.'),
39 'fields' => array(
40 'pid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE,
41 'description' => t('The primary identifier for a journal patch record.'),
42 ),
43 'uid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0,
44 'description' => t('The user id of the author of a journal patch record.'),
45 ),
46 'module' => array('type' => 'text', 'not null' => TRUE,
47 'description' => t('Affected module(s) of a journal patch record.'),
48 ),
49 'description' => array('type' => 'text', 'size' => 'big', 'not null' => TRUE,
50 'description' => t('Description of a journal patch record.'),
51 ),
52 'url' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '',
53 'description' => t('URL of a related issue for a journal patch record.'),
54 ),
55 'status' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '',
56 'description' => t('Status of a journal patch record.'),
57 ),
58 'timestamp' => array('type' => 'int', 'not null' => TRUE, 'default' => 0,
59 'description' => t('The UNIX timestamp when the journal patch record was created.'),
60 ),
61 ),
62 'primary key' => array('pid'),
63 );
64 return $schema;
65 }
66
67 /**
68 * Implementation of hook_install().
69 */
70 function journal_install() {
71 drupal_install_schema('journal');
72 }
73
74 /**
75 * Implementation of hook_uninstall().
76 */
77 function journal_uninstall() {
78 drupal_uninstall_schema('journal');
79 }
80
81 /**
82 * Add index for location.
83 */
84 function journal_update_6100() {
85 $ret = array();
86 db_add_index($ret, 'journal', 'location', array(array('location', 32)));
87 return $ret;
88 }
89
90 /**
91 * Fix location of journal entries for path admin/build/modules.
92 */
93 function journal_update_6101() {
94 $ret = array();
95 switch ($GLOBALS['db_type']) {
96 case 'mysql':
97 case 'mysqli':
98 case 'pgsql':
99 $ret[] = update_sql("UPDATE {journal} SET location = 'admin/build/modules' WHERE location LIKE 'admin/build/modules/list%'");
100 $ret[] = update_sql("UPDATE {journal} SET location = 'admin/build/modules/uninstall' WHERE location LIKE 'admin/build/modules/uninstall%'");
101 break;
102 }
103 return $ret;
104 }
105
106 /**
107 * Add {journal_patch} table.
108 */
109 function journal_update_6102() {
110 $ret = array();
111 if (!db_table_exists('journal_patch')) {
112 db_create_table($ret, 'journal_patch', array(
113 'fields' => array(
114 'pid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE),
115 'uid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
116 'module' => array('type' => 'text', 'not null' => TRUE),
117 'description' => array('type' => 'text', 'size' => 'big', 'not null' => TRUE),
118 'url' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
119 'status' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
120 'timestamp' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
121 ),
122 'primary key' => array('pid'),
123 ));
124 }
125 return $ret;
126 }
127
128 /**
129 * Change jid into type serial field.
130 */
131 function journal_update_6103() {
132 $ret = array();
133 db_drop_primary_key($ret, 'journal');
134 db_change_field($ret, 'journal', 'jid', 'jid', array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE), array('primary key' => array('jid')));
135 return $ret;
136 }
137

  ViewVC Help
Powered by ViewVC 1.1.2