-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuserpoints.install
More file actions
183 lines (177 loc) · 4.57 KB
/
Copy pathuserpoints.install
File metadata and controls
183 lines (177 loc) · 4.57 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
174
175
176
177
178
179
180
181
182
183
<?php
// $Id: userpoints.install,v 1.15.2.6 2010-02-04 21:09:56 kbahey Exp $
/**
* @file
* Install time hook userpoints module.
*/
/**
* Implements hook_schema().
*/
function userpoints_schema() {
$schema = array();
$schema['userpoints'] = array(
'description' => 'Holds the user points',
'fields' => array(
'pid' => array(
'description' => 'User ID',
'type' => 'serial',
'not null' => TRUE,
),
'uid' => array(
'description' => 'User ID',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'points' => array(
'description' => 'Current Points',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'max_points' => array(
'description' => 'Out of a maximum points',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'last_update' => array(
'description' => 'Timestamp',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'tid' => array(
'description' => 'Category ID',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array('pid'),
'indexes' => array(
'last_update' => array('last_update'),
),
'unique keys' => array(
'uid_tid' => array('uid', 'tid'),
),
);
$schema['userpoints_txn'] = array(
'description' => 'Userpoints Transactions',
'fields' => array(
'txn_id' => array(
'description' => 'Transaction ID',
'type' => 'serial',
'not null' => TRUE,
),
'uid' => array(
'description' => 'User ID',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'approver_uid' => array(
'description' => 'Approving User ID',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'points' => array(
'description' => 'Points',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'time_stamp' => array(
'description' => 'Timestamp',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'changed' => array(
'description' => 'Effective timestamp of last action on this transaction, for tracking purposes.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'status' => array(
'description' => 'Status',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
),
'description' => array(
'description' => 'Description',
'type' => 'text',
),
'reference' => array(
'description' => 'Reserved for module specific use',
'type' => 'varchar',
'length' => 128,
),
'expirydate' => array(
'description' => 'Expirydate',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'expired' => array(
'description' => 'User ID',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
),
'parent_txn_id' => array(
'description' => 'Parent Transaction ID',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'tid' => array(
'description' => 'Category ID',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'entity_id' => array(
'description' => 'ID of an entity in the Database',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'entity_type' => array(
'description' => 'Type of entity',
'type' => 'varchar',
'length' => 32,
),
'operation' => array(
'description' => 'Operation being carried out',
'type' => 'varchar',
'length' => 32,
),
),
'primary key' => array('txn_id'),
'indexes' => array(
'operation' => array('operation'),
'reference' => array('reference'),
'status_expired_expiry' => array('status', 'expired', 'expirydate'),
//Optional as in update_6011
'changed' => array('changed'),
)
);
return $schema;
}
/**
* Implements hook_uninstall().
*/
function userpoints_uninstall() {
db_delete('variable')
->condition('name', '%userpoints%', 'LIKE')
->execute();
$vid = db_query("SELECT vid FROM {taxonomy_vocabulary} WHERE module='userpoints'")->fetchField();
if ($vid) {
taxonomy_vocabulary_delete($vid);
}
}