-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodr8.install
More file actions
173 lines (168 loc) · 4.21 KB
/
modr8.install
File metadata and controls
173 lines (168 loc) · 4.21 KB
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
110
111
112
113
114
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<?php
// $Id: modr8.install,v 1.5 2010/04/02 02:59:08 pwolanin Exp $ Line 2: Commits to the Git repository do not require the CVS $Id$ keyword in each file.
/**
* @file
* Install, update and uninstall functions for the modr8 module.
* TODO: write upgrade from Drupal 6.
*
*/
/**
* Implements hook_schema().
*/
function modr8_schema() {
$schema['modr8_moderate'] = array(
'fields' => array(
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'moderate' => array(
'description' => 'Boolean indicating if a node is "in moderation".',
'type' => 'int',
'not null' => TRUE,
'default' => 0),
),
'primary key' => array('nid'),
);
$schema['modr8_log'] = array(
'fields' => array(
'modid' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'uid' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'author_uid' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'action' => array(
'type' => 'varchar',
'length' => 16,
'not null' => TRUE,
'default' => '',
),
'title' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'message' => array(
'type' => 'text',
'size' => 'big',
'not null' => TRUE,
),
'teaser' => array(
'type' => 'text',
'size' => 'big',
'not null' => TRUE,
),
'timestamp' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'indexes' => array(
'nid_time' => array('nid', 'modid'),
'time_action' => array('timestamp', 'action'),
),
'primary key' => array('modid'),
);
return $schema;
}
/**
* Update table definitions.
*/
function modr8_update_1000() {
$ret = array();
$name = 'modr8_log';
$table = array(
'fields' => array(
'modid' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'uid' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'author_uid' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'action' => array(
'type' => 'varchar',
'length' => 16,
'not null' => TRUE,
'default' => '',
),
'title' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'message' => array(
'type' => 'text',
'size' => 'big',
'not null' => TRUE,
),
'teaser' => array(
'type' => 'text',
'size' => 'big',
'not null' => TRUE,
),
'timestamp' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'indexes' => array(
'nid_time' => array('nid', 'modid'),
'action' => array('action'),
),
'primary key' => array('modid'),
);
db_create_table($name, $table);
// hook_update_N() no longer returns a $ret array. Instead, return
// nothing or a translated string indicating the update ran successfully.
// See http://drupal.org/node/224333#update_sql.
return t('TODO Add a descriptive string here to show in the UI.') /* $ret */;
}
/**
* Fix index for new block.
*/
function modr8_update_6001() {
$ret = array();
db_drop_index('modr8_log', 'action');
db_add_index('modr8_log', 'time_action', array('timestamp', 'action'));
// hook_update_N() no longer returns a $ret array. Instead, return
// nothing or a translated string indicating the update ran successfully.
// See http://drupal.org/node/224333#update_sql.
return t('TODO Add a descriptive string here to show in the UI.') /* $ret */;
}