|
1 <?php |
|
2 // $Id: user.install,v 1.5.2.2 2009/07/01 20:51:56 goba Exp $ |
|
3 |
|
4 /** |
|
5 * Implementation of hook_schema(). |
|
6 */ |
|
7 function user_schema() { |
|
8 $schema['access'] = array( |
|
9 'description' => 'Stores site access rules.', |
|
10 'fields' => array( |
|
11 'aid' => array( |
|
12 'type' => 'serial', |
|
13 'not null' => TRUE, |
|
14 'description' => 'Primary Key: Unique access ID.', |
|
15 ), |
|
16 'mask' => array( |
|
17 'type' => 'varchar', |
|
18 'length' => 255, |
|
19 'not null' => TRUE, |
|
20 'default' => '', |
|
21 'description' => 'Text mask used for filtering access.', |
|
22 ), |
|
23 'type' => array( |
|
24 'type' => 'varchar', |
|
25 'length' => 255, |
|
26 'not null' => TRUE, |
|
27 'default' => '', |
|
28 'description' => 'Type of access rule: name, mail or host.', |
|
29 ), |
|
30 'status' => array( |
|
31 'type' => 'int', |
|
32 'not null' => TRUE, |
|
33 'default' => 0, |
|
34 'size' => 'tiny', |
|
35 'description' => 'Whether rule is to allow(1) or deny(0) access.', |
|
36 ), |
|
37 ), |
|
38 'primary key' => array('aid'), |
|
39 ); |
|
40 |
|
41 $schema['authmap'] = array( |
|
42 'description' => 'Stores distributed authentication mapping.', |
|
43 'fields' => array( |
|
44 'aid' => array( |
|
45 'description' => 'Primary Key: Unique authmap ID.', |
|
46 'type' => 'serial', |
|
47 'unsigned' => TRUE, |
|
48 'not null' => TRUE, |
|
49 ), |
|
50 'uid' => array( |
|
51 'type' => 'int', |
|
52 'not null' => TRUE, |
|
53 'default' => 0, |
|
54 'description' => "User's {users}.uid.", |
|
55 ), |
|
56 'authname' => array( |
|
57 'type' => 'varchar', |
|
58 'length' => 128, |
|
59 'not null' => TRUE, |
|
60 'default' => '', |
|
61 'description' => 'Unique authentication name.', |
|
62 ), |
|
63 'module' => array( |
|
64 'type' => 'varchar', |
|
65 'length' => 128, |
|
66 'not null' => TRUE, |
|
67 'default' => '', |
|
68 'description' => 'Module which is controlling the authentication.', |
|
69 ), |
|
70 ), |
|
71 'unique keys' => array('authname' => array('authname')), |
|
72 'primary key' => array('aid'), |
|
73 ); |
|
74 |
|
75 $schema['permission'] = array( |
|
76 'description' => 'Stores permissions for users.', |
|
77 'fields' => array( |
|
78 'pid' => array( |
|
79 'type' => 'serial', |
|
80 'not null' => TRUE, |
|
81 'description' => 'Primary Key: Unique permission ID.', |
|
82 ), |
|
83 'rid' => array( |
|
84 'type' => 'int', |
|
85 'unsigned' => TRUE, |
|
86 'not null' => TRUE, |
|
87 'default' => 0, |
|
88 'description' => 'The {role}.rid to which the permissions are assigned.', |
|
89 ), |
|
90 'perm' => array( |
|
91 'type' => 'text', |
|
92 'not null' => FALSE, |
|
93 'size' => 'big', |
|
94 'description' => 'List of permissions being assigned.', |
|
95 ), |
|
96 'tid' => array( |
|
97 'type' => 'int', |
|
98 'unsigned' => TRUE, |
|
99 'not null' => TRUE, |
|
100 'default' => 0, |
|
101 'description' => 'Originally intended for taxonomy-based permissions, but never used.', |
|
102 ), |
|
103 ), |
|
104 'primary key' => array('pid'), |
|
105 'indexes' => array('rid' => array('rid')), |
|
106 ); |
|
107 |
|
108 $schema['role'] = array( |
|
109 'description' => 'Stores user roles.', |
|
110 'fields' => array( |
|
111 'rid' => array( |
|
112 'type' => 'serial', |
|
113 'unsigned' => TRUE, |
|
114 'not null' => TRUE, |
|
115 'description' => 'Primary Key: Unique role id.', |
|
116 ), |
|
117 'name' => array( |
|
118 'type' => 'varchar', |
|
119 'length' => 64, |
|
120 'not null' => TRUE, |
|
121 'default' => '', |
|
122 'description' => 'Unique role name.', |
|
123 ), |
|
124 ), |
|
125 'unique keys' => array('name' => array('name')), |
|
126 'primary key' => array('rid'), |
|
127 ); |
|
128 |
|
129 $schema['users'] = array( |
|
130 'description' => 'Stores user data.', |
|
131 'fields' => array( |
|
132 'uid' => array( |
|
133 'type' => 'serial', |
|
134 'unsigned' => TRUE, |
|
135 'not null' => TRUE, |
|
136 'description' => 'Primary Key: Unique user ID.', |
|
137 ), |
|
138 'name' => array( |
|
139 'type' => 'varchar', |
|
140 'length' => 60, |
|
141 'not null' => TRUE, |
|
142 'default' => '', |
|
143 'description' => 'Unique user name.', |
|
144 ), |
|
145 'pass' => array( |
|
146 'type' => 'varchar', |
|
147 'length' => 32, |
|
148 'not null' => TRUE, |
|
149 'default' => '', |
|
150 'description' => "User's password (md5 hash).", |
|
151 ), |
|
152 'mail' => array( |
|
153 'type' => 'varchar', |
|
154 'length' => 64, |
|
155 'not null' => FALSE, |
|
156 'default' => '', |
|
157 'description' => "User's email address.", |
|
158 ), |
|
159 'mode' => array( |
|
160 'type' => 'int', |
|
161 'not null' => TRUE, |
|
162 'default' => 0, |
|
163 'size' => 'tiny', |
|
164 'description' => 'Per-user comment display mode (threaded vs. flat), used by the {comment} module.', |
|
165 ), |
|
166 'sort' => array( |
|
167 'type' => 'int', |
|
168 'not null' => FALSE, |
|
169 'default' => 0, |
|
170 'size' => 'tiny', |
|
171 'description' => 'Per-user comment sort order (newest vs. oldest first), used by the {comment} module.', |
|
172 ), |
|
173 'threshold' => array( |
|
174 'type' => 'int', |
|
175 'not null' => FALSE, |
|
176 'default' => 0, |
|
177 'size' => 'tiny', |
|
178 'description' => 'Previously used by the {comment} module for per-user preferences; no longer used.', |
|
179 ), |
|
180 'theme' => array( |
|
181 'type' => 'varchar', |
|
182 'length' => 255, |
|
183 'not null' => TRUE, |
|
184 'default' => '', |
|
185 'description' => "User's default theme.", |
|
186 ), |
|
187 'signature' => array( |
|
188 'type' => 'varchar', |
|
189 'length' => 255, |
|
190 'not null' => TRUE, |
|
191 'default' => '', |
|
192 'description' => "User's signature.", |
|
193 ), |
|
194 'signature_format' => array( |
|
195 'type' => 'int', |
|
196 'size' => 'small', |
|
197 'not null' => TRUE, |
|
198 'default' => 0, |
|
199 'description' => 'The {filter_formats}.format of the signature.', |
|
200 ), |
|
201 'created' => array( |
|
202 'type' => 'int', |
|
203 'not null' => TRUE, |
|
204 'default' => 0, |
|
205 'description' => 'Timestamp for when user was created.', |
|
206 ), |
|
207 'access' => array( |
|
208 'type' => 'int', |
|
209 'not null' => TRUE, |
|
210 'default' => 0, |
|
211 'description' => 'Timestamp for previous time user accessed the site.', |
|
212 ), |
|
213 'login' => array( |
|
214 'type' => 'int', |
|
215 'not null' => TRUE, |
|
216 'default' => 0, |
|
217 'description' => "Timestamp for user's last login.", |
|
218 ), |
|
219 'status' => array( |
|
220 'type' => 'int', |
|
221 'not null' => TRUE, |
|
222 'default' => 0, |
|
223 'size' => 'tiny', |
|
224 'description' => 'Whether the user is active(1) or blocked(0).', |
|
225 ), |
|
226 'timezone' => array( |
|
227 'type' => 'varchar', |
|
228 'length' => 8, |
|
229 'not null' => FALSE, |
|
230 'description' => "User's timezone.", |
|
231 ), |
|
232 'language' => array( |
|
233 'type' => 'varchar', |
|
234 'length' => 12, |
|
235 'not null' => TRUE, |
|
236 'default' => '', |
|
237 'description' => "User's default language.", |
|
238 ), |
|
239 'picture' => array( |
|
240 'type' => 'varchar', |
|
241 'length' => 255, |
|
242 'not null' => TRUE, |
|
243 'default' => '', |
|
244 'description' => "Path to the user's uploaded picture.", |
|
245 ), |
|
246 'init' => array( |
|
247 'type' => 'varchar', |
|
248 'length' => 64, |
|
249 'not null' => FALSE, |
|
250 'default' => '', |
|
251 'description' => 'Email address used for initial account creation.', |
|
252 ), |
|
253 'data' => array( |
|
254 'type' => 'text', |
|
255 'not null' => FALSE, |
|
256 'size' => 'big', |
|
257 'description' => 'A serialized array of name value pairs that are related to the user. Any form values posted during user edit are stored and are loaded into the $user object during user_load(). Use of this field is discouraged and it will likely disappear in a future version of Drupal.', |
|
258 ), |
|
259 ), |
|
260 'indexes' => array( |
|
261 'access' => array('access'), |
|
262 'created' => array('created'), |
|
263 'mail' => array('mail'), |
|
264 ), |
|
265 'unique keys' => array( |
|
266 'name' => array('name'), |
|
267 ), |
|
268 'primary key' => array('uid'), |
|
269 ); |
|
270 |
|
271 $schema['users_roles'] = array( |
|
272 'description' => 'Maps users to roles.', |
|
273 'fields' => array( |
|
274 'uid' => array( |
|
275 'type' => 'int', |
|
276 'unsigned' => TRUE, |
|
277 'not null' => TRUE, |
|
278 'default' => 0, |
|
279 'description' => 'Primary Key: {users}.uid for user.', |
|
280 ), |
|
281 'rid' => array( |
|
282 'type' => 'int', |
|
283 'unsigned' => TRUE, |
|
284 'not null' => TRUE, |
|
285 'default' => 0, |
|
286 'description' => 'Primary Key: {role}.rid for role.', |
|
287 ), |
|
288 ), |
|
289 'primary key' => array('uid', 'rid'), |
|
290 'indexes' => array( |
|
291 'rid' => array('rid'), |
|
292 ), |
|
293 ); |
|
294 |
|
295 return $schema; |
|
296 } |
|
297 |