作者 邓超

login

正在显示 105 个修改的文件 包含 152 行增加2869 行删除
1 -CREATE TABLE [dbo].[cache] (  
2 - [user_id] [int] NOT NULL ,  
3 - [cache_key] [varchar] (128) COLLATE Latin1_General_CS_AS NOT NULL ,  
4 - [expires] [datetime] NULL ,  
5 - [data] [text] COLLATE Latin1_General_CI_AI NOT NULL  
6 -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]  
7 -GO  
8 -  
9 -CREATE TABLE [dbo].[cache_shared] (  
10 - [cache_key] [varchar] (255) COLLATE Latin1_General_CS_AS NOT NULL ,  
11 - [expires] [datetime] NULL ,  
12 - [data] [text] COLLATE Latin1_General_CI_AI NOT NULL  
13 -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]  
14 -GO  
15 -  
16 -CREATE TABLE [dbo].[cache_index] (  
17 - [user_id] [int] NOT NULL ,  
18 - [mailbox] [varchar] (128) COLLATE Latin1_General_CS_AS NOT NULL ,  
19 - [expires] [datetime] NULL ,  
20 - [valid] [char] (1) COLLATE Latin1_General_CI_AI NOT NULL ,  
21 - [data] [text] COLLATE Latin1_General_CI_AI NOT NULL  
22 -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]  
23 -GO  
24 -  
25 -CREATE TABLE [dbo].[cache_thread] (  
26 - [user_id] [int] NOT NULL ,  
27 - [mailbox] [varchar] (128) COLLATE Latin1_General_CS_AS NOT NULL ,  
28 - [expires] [datetime] NULL ,  
29 - [data] [text] COLLATE Latin1_General_CI_AI NOT NULL  
30 -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]  
31 -GO  
32 -  
33 -CREATE TABLE [dbo].[cache_messages] (  
34 - [user_id] [int] NOT NULL ,  
35 - [mailbox] [varchar] (128) COLLATE Latin1_General_CS_AS NOT NULL ,  
36 - [uid] [int] NOT NULL ,  
37 - [expires] [datetime] NULL ,  
38 - [data] [text] COLLATE Latin1_General_CI_AI NOT NULL ,  
39 - [flags] [int] NOT NULL  
40 -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]  
41 -GO  
42 -  
43 -CREATE TABLE [dbo].[collected_addresses] (  
44 - [address_id] [int] IDENTITY (1, 1) NOT NULL ,  
45 - [user_id] [int] NOT NULL ,  
46 - [changed] [datetime] NOT NULL ,  
47 - [name] [varchar] (255) COLLATE Latin1_General_CI_AI NOT NULL ,  
48 - [email] [varchar] (255) COLLATE Latin1_General_CI_AI NOT NULL ,  
49 - [type] [int] NOT NULL  
50 -) ON [PRIMARY]  
51 -GO  
52 -  
53 -CREATE TABLE [dbo].[contacts] (  
54 - [contact_id] [int] IDENTITY (1, 1) NOT NULL ,  
55 - [user_id] [int] NOT NULL ,  
56 - [changed] [datetime] NOT NULL ,  
57 - [del] [char] (1) COLLATE Latin1_General_CI_AI NOT NULL ,  
58 - [name] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,  
59 - [email] [varchar] (8000) COLLATE Latin1_General_CI_AI NOT NULL ,  
60 - [firstname] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,  
61 - [surname] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,  
62 - [vcard] [text] COLLATE Latin1_General_CI_AI NULL ,  
63 - [words] [text] COLLATE Latin1_General_CI_AI NULL  
64 -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]  
65 -GO  
66 -  
67 -CREATE TABLE [dbo].[contactgroups] (  
68 - [contactgroup_id] [int] IDENTITY (1, 1) NOT NULL ,  
69 - [user_id] [int] NOT NULL ,  
70 - [changed] [datetime] NOT NULL ,  
71 - [del] [char] (1) COLLATE Latin1_General_CI_AI NOT NULL ,  
72 - [name] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL  
73 -) ON [PRIMARY]  
74 -GO  
75 -  
76 -CREATE TABLE [dbo].[contactgroupmembers] (  
77 - [contactgroup_id] [int] NOT NULL ,  
78 - [contact_id] [int] NOT NULL ,  
79 - [created] [datetime] NOT NULL  
80 -) ON [PRIMARY]  
81 -GO  
82 -  
83 -CREATE TABLE [dbo].[identities] (  
84 - [identity_id] [int] IDENTITY (1, 1) NOT NULL ,  
85 - [user_id] [int] NOT NULL ,  
86 - [changed] [datetime] NOT NULL ,  
87 - [del] [char] (1) COLLATE Latin1_General_CI_AI NOT NULL ,  
88 - [standard] [char] (1) COLLATE Latin1_General_CI_AI NOT NULL ,  
89 - [name] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,  
90 - [organization] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,  
91 - [email] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,  
92 - [reply-to] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,  
93 - [bcc] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,  
94 - [signature] [text] COLLATE Latin1_General_CI_AI NULL,  
95 - [html_signature] [char] (1) COLLATE Latin1_General_CI_AI NOT NULL  
96 -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]  
97 -GO  
98 -  
99 -CREATE TABLE [dbo].[session] (  
100 - [sess_id] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,  
101 - [changed] [datetime] NULL ,  
102 - [ip] [varchar] (40) COLLATE Latin1_General_CI_AI NOT NULL ,  
103 - [vars] [text] COLLATE Latin1_General_CI_AI NOT NULL  
104 -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]  
105 -GO  
106 -  
107 -CREATE TABLE [dbo].[users] (  
108 - [user_id] [int] IDENTITY (1, 1) NOT NULL ,  
109 - [username] [varchar] (128) COLLATE Latin1_General_CS_AS NOT NULL ,  
110 - [mail_host] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,  
111 - [created] [datetime] NOT NULL ,  
112 - [last_login] [datetime] NULL ,  
113 - [failed_login] [datetime] NULL ,  
114 - [failed_login_counter] [int] NULL ,  
115 - [language] [varchar] (16) COLLATE Latin1_General_CI_AI NULL ,  
116 - [preferences] [text] COLLATE Latin1_General_CI_AI NULL  
117 -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]  
118 -GO  
119 -  
120 -CREATE TABLE [dbo].[dictionary] (  
121 - [user_id] [int] ,  
122 - [language] [varchar] (16) COLLATE Latin1_General_CI_AI NOT NULL ,  
123 - [data] [text] COLLATE Latin1_General_CI_AI NOT NULL  
124 -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]  
125 -GO  
126 -  
127 -CREATE TABLE [dbo].[searches] (  
128 - [search_id] [int] IDENTITY (1, 1) NOT NULL ,  
129 - [user_id] [int] NOT NULL ,  
130 - [type] [tinyint] NOT NULL ,  
131 - [name] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,  
132 - [data] [text] COLLATE Latin1_General_CI_AI NOT NULL  
133 -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]  
134 -GO  
135 -  
136 -CREATE TABLE [dbo].[filestore] (  
137 - [file_id] [int] IDENTITY (1, 1) NOT NULL ,  
138 - [user_id] [int] NOT NULL ,  
139 - [context] [varchar] (32) COLLATE Latin1_General_CI_AI NOT NULL ,  
140 - [filename] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,  
141 - [mtime] [int] NOT NULL ,  
142 - [data] [text] COLLATE Latin1_General_CI_AI NULL ,  
143 -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]  
144 -GO  
145 -  
146 -CREATE TABLE [dbo].[system] (  
147 - [name] [varchar] (64) COLLATE Latin1_General_CI_AI NOT NULL ,  
148 - [value] [text] COLLATE Latin1_General_CI_AI NOT NULL  
149 -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]  
150 -GO  
151 -  
152 -ALTER TABLE [dbo].[cache] WITH NOCHECK ADD  
153 - PRIMARY KEY CLUSTERED  
154 - (  
155 - [user_id],[cache_key]  
156 - ) ON [PRIMARY]  
157 -GO  
158 -  
159 -ALTER TABLE [dbo].[cache_shared] WITH NOCHECK ADD  
160 - PRIMARY KEY CLUSTERED  
161 - (  
162 - [cache_key]  
163 - ) ON [PRIMARY]  
164 -GO  
165 -  
166 -ALTER TABLE [dbo].[cache_index] WITH NOCHECK ADD  
167 - PRIMARY KEY CLUSTERED  
168 - (  
169 - [user_id],[mailbox]  
170 - ) ON [PRIMARY]  
171 -GO  
172 -  
173 -ALTER TABLE [dbo].[cache_thread] WITH NOCHECK ADD  
174 - PRIMARY KEY CLUSTERED  
175 - (  
176 - [user_id],[mailbox]  
177 - ) ON [PRIMARY]  
178 -GO  
179 -  
180 -ALTER TABLE [dbo].[cache_messages] WITH NOCHECK ADD  
181 - PRIMARY KEY CLUSTERED  
182 - (  
183 - [user_id],[mailbox],[uid]  
184 - ) ON [PRIMARY]  
185 -GO  
186 -  
187 -ALTER TABLE [dbo].[collected_addresses] WITH NOCHECK ADD  
188 - CONSTRAINT [PK_collected_addresses_address_id] PRIMARY KEY CLUSTERED  
189 - (  
190 - [address_id]  
191 - ) ON [PRIMARY]  
192 -GO  
193 -  
194 -ALTER TABLE [dbo].[contacts] WITH NOCHECK ADD  
195 - CONSTRAINT [PK_contacts_contact_id] PRIMARY KEY CLUSTERED  
196 - (  
197 - [contact_id]  
198 - ) ON [PRIMARY]  
199 -GO  
200 -  
201 -ALTER TABLE [dbo].[contactgroups] WITH NOCHECK ADD  
202 - CONSTRAINT [PK_contactgroups_contactgroup_id] PRIMARY KEY CLUSTERED  
203 - (  
204 - [contactgroup_id]  
205 - ) ON [PRIMARY]  
206 -GO  
207 -  
208 -ALTER TABLE [dbo].[contactgroupmembers] WITH NOCHECK ADD  
209 - CONSTRAINT [PK_contactgroupmembers_id] PRIMARY KEY CLUSTERED  
210 - (  
211 - [contactgroup_id], [contact_id]  
212 - ) ON [PRIMARY]  
213 -GO  
214 -  
215 -ALTER TABLE [dbo].[identities] WITH NOCHECK ADD  
216 - PRIMARY KEY CLUSTERED  
217 - (  
218 - [identity_id]  
219 - ) ON [PRIMARY]  
220 -GO  
221 -  
222 -ALTER TABLE [dbo].[session] WITH NOCHECK ADD  
223 - CONSTRAINT [PK_session_sess_id] PRIMARY KEY CLUSTERED  
224 - (  
225 - [sess_id]  
226 - ) ON [PRIMARY]  
227 -GO  
228 -  
229 -ALTER TABLE [dbo].[users] WITH NOCHECK ADD  
230 - CONSTRAINT [PK_users_user_id] PRIMARY KEY CLUSTERED  
231 - (  
232 - [user_id]  
233 - ) ON [PRIMARY]  
234 -GO  
235 -  
236 -ALTER TABLE [dbo].[searches] WITH NOCHECK ADD  
237 - CONSTRAINT [PK_searches_search_id] PRIMARY KEY CLUSTERED  
238 - (  
239 - [search_id]  
240 - ) ON [PRIMARY]  
241 -GO  
242 -  
243 -ALTER TABLE [dbo].[filestore] WITH NOCHECK ADD  
244 - CONSTRAINT [PK_filestore_file_id] PRIMARY KEY CLUSTERED  
245 - (  
246 - [file_id]  
247 - ) ON [PRIMARY]  
248 -GO  
249 -  
250 -ALTER TABLE [dbo].[system] WITH NOCHECK ADD  
251 - CONSTRAINT [PK_system_name] PRIMARY KEY CLUSTERED  
252 - (  
253 - [name]  
254 - ) ON [PRIMARY]  
255 -GO  
256 -  
257 -ALTER TABLE [dbo].[cache] ADD  
258 - CONSTRAINT [DF_cache_user_id] DEFAULT ('0') FOR [user_id],  
259 - CONSTRAINT [DF_cache_cache_key] DEFAULT ('') FOR [cache_key]  
260 -GO  
261 -  
262 -ALTER TABLE [dbo].[cache_index] ADD  
263 - CONSTRAINT [DF_cache_index_valid] DEFAULT ('0') FOR [valid]  
264 -GO  
265 -  
266 -ALTER TABLE [dbo].[cache_messages] ADD  
267 - CONSTRAINT [DF_cache_messages_flags] DEFAULT (0) FOR [flags]  
268 -GO  
269 -  
270 -CREATE INDEX [IX_cache_shared_cache_key] ON [dbo].[cache_shared]([cache_key]) ON [PRIMARY]  
271 -GO  
272 -  
273 -CREATE INDEX [IX_cache_index_user_id] ON [dbo].[cache_index]([user_id]) ON [PRIMARY]  
274 -GO  
275 -  
276 -CREATE INDEX [IX_cache_thread_user_id] ON [dbo].[cache_thread]([user_id]) ON [PRIMARY]  
277 -GO  
278 -  
279 -CREATE INDEX [IX_cache_messages_user_id] ON [dbo].[cache_messages]([user_id]) ON [PRIMARY]  
280 -GO  
281 -  
282 -CREATE INDEX [IX_cache_expires] ON [dbo].[cache]([expires]) ON [PRIMARY]  
283 -GO  
284 -  
285 -CREATE INDEX [IX_cache_shared_expires] ON [dbo].[cache_shared]([expires]) ON [PRIMARY]  
286 -GO  
287 -  
288 -CREATE INDEX [IX_cache_index_expires] ON [dbo].[cache_index]([expires]) ON [PRIMARY]  
289 -GO  
290 -  
291 -CREATE INDEX [IX_cache_thread_expires] ON [dbo].[cache_thread]([expires]) ON [PRIMARY]  
292 -GO  
293 -  
294 -CREATE INDEX [IX_cache_messages_expires] ON [dbo].[cache_messages]([expires]) ON [PRIMARY]  
295 -GO  
296 -  
297 -ALTER TABLE [dbo].[collected_addresses] ADD  
298 - CONSTRAINT [DF_collected_addresses_user_id] DEFAULT (0) FOR [user_id],  
299 - CONSTRAINT [DF_collected_addresses_changed] DEFAULT (getdate()) FOR [changed],  
300 - CONSTRAINT [DF_collected_addresses_name] DEFAULT ('') FOR [name]  
301 -GO  
302 -  
303 -CREATE UNIQUE INDEX [IX_collected_addresses_user_id] ON [dbo].[collected_addresses]([user_id],[type],[email]) ON [PRIMARY]  
304 -GO  
305 -  
306 -ALTER TABLE [dbo].[contacts] ADD  
307 - CONSTRAINT [DF_contacts_user_id] DEFAULT (0) FOR [user_id],  
308 - CONSTRAINT [DF_contacts_changed] DEFAULT (getdate()) FOR [changed],  
309 - CONSTRAINT [DF_contacts_del] DEFAULT ('0') FOR [del],  
310 - CONSTRAINT [DF_contacts_name] DEFAULT ('') FOR [name],  
311 - CONSTRAINT [DF_contacts_email] DEFAULT ('') FOR [email],  
312 - CONSTRAINT [DF_contacts_firstname] DEFAULT ('') FOR [firstname],  
313 - CONSTRAINT [DF_contacts_surname] DEFAULT ('') FOR [surname],  
314 - CONSTRAINT [CK_contacts_del] CHECK ([del] = '1' or [del] = '0')  
315 -GO  
316 -  
317 -CREATE INDEX [IX_contacts_user_id] ON [dbo].[contacts]([user_id]) ON [PRIMARY]  
318 -GO  
319 -  
320 -ALTER TABLE [dbo].[contactgroups] ADD  
321 - CONSTRAINT [DF_contactgroups_user_id] DEFAULT (0) FOR [user_id],  
322 - CONSTRAINT [DF_contactgroups_changed] DEFAULT (getdate()) FOR [changed],  
323 - CONSTRAINT [DF_contactgroups_del] DEFAULT ('0') FOR [del],  
324 - CONSTRAINT [DF_contactgroups_name] DEFAULT ('') FOR [name],  
325 - CONSTRAINT [CK_contactgroups_del] CHECK ([del] = '1' or [del] = '0')  
326 -GO  
327 -  
328 -CREATE INDEX [IX_contactgroups_user_id] ON [dbo].[contactgroups]([user_id]) ON [PRIMARY]  
329 -GO  
330 -  
331 -ALTER TABLE [dbo].[contactgroupmembers] ADD  
332 - CONSTRAINT [DF_contactgroupmembers_contactgroup_id] DEFAULT (0) FOR [contactgroup_id],  
333 - CONSTRAINT [DF_contactgroupmembers_contact_id] DEFAULT (0) FOR [contact_id],  
334 - CONSTRAINT [DF_contactgroupmembers_created] DEFAULT (getdate()) FOR [created]  
335 -GO  
336 -  
337 -CREATE INDEX [IX_contactgroupmembers_contact_id] ON [dbo].[contactgroupmembers]([contact_id]) ON [PRIMARY]  
338 -GO  
339 -  
340 -ALTER TABLE [dbo].[identities] ADD  
341 - CONSTRAINT [DF_identities_user] DEFAULT ('0') FOR [user_id],  
342 - CONSTRAINT [DF_identities_del] DEFAULT ('0') FOR [del],  
343 - CONSTRAINT [DF_identities_standard] DEFAULT ('0') FOR [standard],  
344 - CONSTRAINT [DF_identities_name] DEFAULT ('') FOR [name],  
345 - CONSTRAINT [DF_identities_organization] DEFAULT ('') FOR [organization],  
346 - CONSTRAINT [DF_identities_email] DEFAULT ('') FOR [email],  
347 - CONSTRAINT [DF_identities_reply] DEFAULT ('') FOR [reply-to],  
348 - CONSTRAINT [DF_identities_bcc] DEFAULT ('') FOR [bcc],  
349 - CONSTRAINT [DF_identities_html_signature] DEFAULT ('0') FOR [html_signature],  
350 - CHECK ([standard] = '1' or [standard] = '0'),  
351 - CHECK ([del] = '1' or [del] = '0')  
352 -GO  
353 -  
354 -CREATE INDEX [IX_identities_user_id] ON [dbo].[identities]([user_id]) ON [PRIMARY]  
355 -GO  
356 -CREATE INDEX [IX_identities_email] ON [dbo].[identities]([email],[del]) ON [PRIMARY]  
357 -GO  
358 -  
359 -ALTER TABLE [dbo].[session] ADD  
360 - CONSTRAINT [DF_session_sess_id] DEFAULT ('') FOR [sess_id],  
361 - CONSTRAINT [DF_session_ip] DEFAULT ('') FOR [ip]  
362 -GO  
363 -  
364 -CREATE INDEX [IX_session_changed] ON [dbo].[session]([changed]) ON [PRIMARY]  
365 -GO  
366 -  
367 -CREATE INDEX [IX_filestore_user_id] ON [dbo].[filestore]([user_id]) ON [PRIMARY]  
368 -GO  
369 -  
370 -ALTER TABLE [dbo].[users] ADD  
371 - CONSTRAINT [DF_users_username] DEFAULT ('') FOR [username],  
372 - CONSTRAINT [DF_users_mail_host] DEFAULT ('') FOR [mail_host],  
373 - CONSTRAINT [DF_users_created] DEFAULT (getdate()) FOR [created]  
374 -GO  
375 -  
376 -CREATE UNIQUE INDEX [IX_users_username] ON [dbo].[users]([username],[mail_host]) ON [PRIMARY]  
377 -GO  
378 -  
379 -CREATE UNIQUE INDEX [IX_dictionary_user_language] ON [dbo].[dictionary]([user_id],[language]) ON [PRIMARY]  
380 -GO  
381 -  
382 -ALTER TABLE [dbo].[searches] ADD  
383 - CONSTRAINT [DF_searches_user] DEFAULT (0) FOR [user_id],  
384 - CONSTRAINT [DF_searches_type] DEFAULT (0) FOR [type]  
385 -GO  
386 -  
387 -CREATE UNIQUE INDEX [IX_searches_user_type_name] ON [dbo].[searches]([user_id],[type],[name]) ON [PRIMARY]  
388 -GO  
389 -  
390 -CREATE UNIQUE INDEX [IX_filestore_user_id_context_filename] ON [dbo].[filestore]([user_id],[context],[filename]) ON [PRIMARY]  
391 -GO  
392 -  
393 -ALTER TABLE [dbo].[identities] ADD CONSTRAINT [FK_identities_user_id]  
394 - FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])  
395 - ON DELETE CASCADE ON UPDATE CASCADE  
396 -GO  
397 -  
398 -ALTER TABLE [dbo].[collected_addresses] ADD CONSTRAINT [FK_collected_addresses_user_id]  
399 - FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])  
400 - ON DELETE CASCADE ON UPDATE CASCADE  
401 -GO  
402 -  
403 -ALTER TABLE [dbo].[contacts] ADD CONSTRAINT [FK_contacts_user_id]  
404 - FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])  
405 - ON DELETE CASCADE ON UPDATE CASCADE  
406 -GO  
407 -  
408 -ALTER TABLE [dbo].[contactgroups] ADD CONSTRAINT [FK_contactgroups_user_id]  
409 - FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])  
410 - ON DELETE CASCADE ON UPDATE CASCADE  
411 -GO  
412 -  
413 -ALTER TABLE [dbo].[cache] ADD CONSTRAINT [FK_cache_user_id]  
414 - FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])  
415 - ON DELETE CASCADE ON UPDATE CASCADE  
416 -GO  
417 -  
418 -ALTER TABLE [dbo].[cache_index] ADD CONSTRAINT [FK_cache_index_user_id]  
419 - FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])  
420 - ON DELETE CASCADE ON UPDATE CASCADE  
421 -GO  
422 -  
423 -ALTER TABLE [dbo].[cache_thread] ADD CONSTRAINT [FK_cache_thread_user_id]  
424 - FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])  
425 - ON DELETE CASCADE ON UPDATE CASCADE  
426 -GO  
427 -  
428 -ALTER TABLE [dbo].[cache_messages] ADD CONSTRAINT [FK_cache_messages_user_id]  
429 - FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])  
430 - ON DELETE CASCADE ON UPDATE CASCADE  
431 -GO  
432 -  
433 -ALTER TABLE [dbo].[contactgroupmembers] ADD CONSTRAINT [FK_contactgroupmembers_contactgroup_id]  
434 - FOREIGN KEY ([contactgroup_id]) REFERENCES [dbo].[contactgroups] ([contactgroup_id])  
435 - ON DELETE CASCADE ON UPDATE CASCADE  
436 -GO  
437 -  
438 -ALTER TABLE [dbo].[searches] ADD CONSTRAINT [FK_searches_user_id]  
439 - FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])  
440 - ON DELETE CASCADE ON UPDATE CASCADE  
441 -GO  
442 -  
443 -ALTER TABLE [dbo].[filestore] ADD CONSTRAINT [FK_filestore_user_id]  
444 - FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])  
445 - ON DELETE CASCADE ON UPDATE CASCADE  
446 -GO  
447 -  
448 --- Use trigger instead of foreign key (#1487112)  
449 --- "Introducing FOREIGN KEY constraint ... may cause cycles or multiple cascade paths."  
450 -CREATE TRIGGER [contact_delete_member] ON [dbo].[contacts]  
451 - AFTER DELETE AS  
452 - DELETE FROM [dbo].[contactgroupmembers]  
453 - WHERE [contact_id] IN (SELECT [contact_id] FROM deleted)  
454 -GO  
455 -  
456 -INSERT INTO [dbo].[system] ([name], [value]) VALUES ('roundcube-version', '2020122900')  
457 -GO  
458 -  
1 --- Updates from version 0.3.1  
2 -  
3 -ALTER TABLE [dbo].[messages] ADD CONSTRAINT [FK_messages_user_id]  
4 - FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])  
5 - ON DELETE CASCADE ON UPDATE CASCADE  
6 -GO  
7 -  
8 -ALTER TABLE [dbo].[cache] ADD CONSTRAINT [FK_cache_user_id]  
9 - FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])  
10 - ON DELETE CASCADE ON UPDATE CASCADE  
11 -GO  
12 -  
13 -ALTER TABLE [dbo].[contacts] ADD CONSTRAINT [FK_contacts_user_id]  
14 - FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])  
15 - ON DELETE CASCADE ON UPDATE CASCADE  
16 -GO  
17 -  
18 -ALTER TABLE [dbo].[identities] ADD CONSTRAINT [FK_identities_user_id]  
19 - FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])  
20 - ON DELETE CASCADE ON UPDATE CASCADE  
21 -GO  
22 -  
23 -ALTER TABLE [dbo].[identities] ADD [changed] [datetime] NULL  
24 -GO  
25 -  
26 -CREATE TABLE [dbo].[contactgroups] (  
27 - [contactgroup_id] [int] IDENTITY (1, 1) NOT NULL ,  
28 - [user_id] [int] NOT NULL ,  
29 - [changed] [datetime] NOT NULL ,  
30 - [del] [char] (1) COLLATE Latin1_General_CI_AI NOT NULL ,  
31 - [name] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL  
32 -) ON [PRIMARY]  
33 -GO  
34 -  
35 -CREATE TABLE [dbo].[contactgroupmembers] (  
36 - [contactgroup_id] [int] NOT NULL ,  
37 - [contact_id] [int] NOT NULL ,  
38 - [created] [datetime] NOT NULL  
39 -) ON [PRIMARY]  
40 -GO  
41 -  
42 -ALTER TABLE [dbo].[contactgroups] WITH NOCHECK ADD  
43 - CONSTRAINT [PK_contactgroups_contactgroup_id] PRIMARY KEY CLUSTERED  
44 - (  
45 - [contactgroup_id]  
46 - ) ON [PRIMARY]  
47 -GO  
48 -  
49 -ALTER TABLE [dbo].[contactgroupmembers] WITH NOCHECK ADD  
50 - CONSTRAINT [PK_contactgroupmembers_id] PRIMARY KEY CLUSTERED  
51 - (  
52 - [contactgroup_id], [contact_id]  
53 - ) ON [PRIMARY]  
54 -GO  
55 -  
56 -ALTER TABLE [dbo].[contactgroups] ADD  
57 - CONSTRAINT [DF_contactgroups_user_id] DEFAULT (0) FOR [user_id],  
58 - CONSTRAINT [DF_contactgroups_changed] DEFAULT (getdate()) FOR [changed],  
59 - CONSTRAINT [DF_contactgroups_del] DEFAULT ('0') FOR [del],  
60 - CONSTRAINT [DF_contactgroups_name] DEFAULT ('') FOR [name],  
61 - CONSTRAINT [CK_contactgroups_del] CHECK ([del] = '1' or [del] = '0')  
62 -GO  
63 -  
64 -CREATE INDEX [IX_contactgroups_user_id] ON [dbo].[contacts]([user_id]) ON [PRIMARY]  
65 -GO  
66 -  
67 -ALTER TABLE [dbo].[contactgroupmembers] ADD  
68 - CONSTRAINT [DF_contactgroupmembers_contactgroup_id] DEFAULT (0) FOR [contactgroup_id],  
69 - CONSTRAINT [DF_contactgroupmembers_contact_id] DEFAULT (0) FOR [contact_id],  
70 - CONSTRAINT [DF_contactgroupmembers_created] DEFAULT (getdate()) FOR [created]  
71 -GO  
72 -  
73 -ALTER TABLE [dbo].[contactgroupmembers] ADD CONSTRAINT [FK_contactgroupmembers_contactgroup_id]  
74 - FOREIGN KEY ([contactgroup_id]) REFERENCES [dbo].[contactgroups] ([contactgroup_id])  
75 - ON DELETE CASCADE ON UPDATE CASCADE  
76 -GO  
77 -  
78 -CREATE TRIGGER [contact_delete_member] ON [dbo].[contacts]  
79 - AFTER DELETE AS  
80 - DELETE FROM [dbo].[contactgroupmembers]  
81 - WHERE [contact_id] IN (SELECT [contact_id] FROM deleted)  
82 -GO  
83 -  
84 -ALTER TABLE [dbo].[contactgroups] ADD CONSTRAINT [FK_contactgroups_user_id]  
85 - FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])  
86 - ON DELETE CASCADE ON UPDATE CASCADE  
87 -GO  
1 --- Updates from version 0.4.2  
2 -  
3 -DROP INDEX [IX_users_username]  
4 -GO  
5 -CREATE UNIQUE INDEX [IX_users_username] ON [dbo].[users]([username],[mail_host]) ON [PRIMARY]  
6 -GO  
7 -ALTER TABLE [dbo].[contacts] ALTER COLUMN [email] [varchar] (255) COLLATE Latin1_General_CI_AI NOT NULL  
8 -GO  
9 -  
1 --- Updates from version 0.5.x  
2 -  
3 -ALTER TABLE [dbo].[contacts] ADD [words] [text] COLLATE Latin1_General_CI_AI NULL  
4 -GO  
5 -CREATE INDEX [IX_contactgroupmembers_contact_id] ON [dbo].[contactgroupmembers]([contact_id]) ON [PRIMARY]  
6 -GO  
7 -DELETE FROM [dbo].[messages]  
8 -GO  
9 -DELETE FROM [dbo].[cache]  
10 -GO  
1 --- Updates from version 0.6  
2 -  
3 -CREATE TABLE [dbo].[dictionary] (  
4 - [user_id] [int] ,  
5 - [language] [varchar] (5) COLLATE Latin1_General_CI_AI NOT NULL ,  
6 - [data] [text] COLLATE Latin1_General_CI_AI NOT NULL  
7 -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]  
8 -GO  
9 -CREATE UNIQUE INDEX [IX_dictionary_user_language] ON [dbo].[dictionary]([user_id],[language]) ON [PRIMARY]  
10 -GO  
11 -  
12 -CREATE TABLE [dbo].[searches] (  
13 - [search_id] [int] IDENTITY (1, 1) NOT NULL ,  
14 - [user_id] [int] NOT NULL ,  
15 - [type] [tinyint] NOT NULL ,  
16 - [name] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,  
17 - [data] [text] COLLATE Latin1_General_CI_AI NOT NULL  
18 -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]  
19 -GO  
20 -  
21 -ALTER TABLE [dbo].[searches] WITH NOCHECK ADD  
22 - CONSTRAINT [PK_searches_search_id] PRIMARY KEY CLUSTERED  
23 - (  
24 - [search_id]  
25 - ) ON [PRIMARY]  
26 -GO  
27 -  
28 -ALTER TABLE [dbo].[searches] ADD  
29 - CONSTRAINT [DF_searches_user] DEFAULT (0) FOR [user_id],  
30 - CONSTRAINT [DF_searches_type] DEFAULT (0) FOR [type],  
31 -GO  
32 -  
33 -CREATE UNIQUE INDEX [IX_searches_user_type_name] ON [dbo].[searches]([user_id],[type],[name]) ON [PRIMARY]  
34 -GO  
35 -  
36 -ALTER TABLE [dbo].[searches] ADD CONSTRAINT [FK_searches_user_id]  
37 - FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])  
38 - ON DELETE CASCADE ON UPDATE CASCADE  
39 -GO  
40 -  
41 -DROP TABLE [dbo].[messages]  
42 -GO  
43 -CREATE TABLE [dbo].[cache_index] (  
44 - [user_id] [int] NOT NULL ,  
45 - [mailbox] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,  
46 - [changed] [datetime] NOT NULL ,  
47 - [valid] [char] (1) COLLATE Latin1_General_CI_AI NOT NULL ,  
48 - [data] [text] COLLATE Latin1_General_CI_AI NOT NULL  
49 -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]  
50 -GO  
51 -  
52 -CREATE TABLE [dbo].[cache_thread] (  
53 - [user_id] [int] NOT NULL ,  
54 - [mailbox] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,  
55 - [changed] [datetime] NOT NULL ,  
56 - [data] [text] COLLATE Latin1_General_CI_AI NOT NULL  
57 -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]  
58 -GO  
59 -  
60 -CREATE TABLE [dbo].[cache_messages] (  
61 - [user_id] [int] NOT NULL ,  
62 - [mailbox] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,  
63 - [uid] [int] NOT NULL ,  
64 - [changed] [datetime] NOT NULL ,  
65 - [data] [text] COLLATE Latin1_General_CI_AI NOT NULL ,  
66 - [flags] [int] NOT NULL  
67 -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]  
68 -GO  
69 -  
70 -ALTER TABLE [dbo].[cache_index] WITH NOCHECK ADD  
71 - PRIMARY KEY CLUSTERED  
72 - (  
73 - [user_id],[mailbox]  
74 - ) ON [PRIMARY]  
75 -GO  
76 -  
77 -ALTER TABLE [dbo].[cache_thread] WITH NOCHECK ADD  
78 - PRIMARY KEY CLUSTERED  
79 - (  
80 - [user_id],[mailbox]  
81 - ) ON [PRIMARY]  
82 -GO  
83 -  
84 -ALTER TABLE [dbo].[cache_messages] WITH NOCHECK ADD  
85 - PRIMARY KEY CLUSTERED  
86 - (  
87 - [user_id],[mailbox],[uid]  
88 - ) ON [PRIMARY]  
89 -GO  
90 -  
91 -ALTER TABLE [dbo].[cache_index] ADD  
92 - CONSTRAINT [DF_cache_index_changed] DEFAULT (getdate()) FOR [changed],  
93 - CONSTRAINT [DF_cache_index_valid] DEFAULT ('0') FOR [valid]  
94 -GO  
95 -  
96 -CREATE INDEX [IX_cache_index_user_id] ON [dbo].[cache_index]([user_id]) ON [PRIMARY]  
97 -GO  
98 -  
99 -ALTER TABLE [dbo].[cache_thread] ADD  
100 - CONSTRAINT [DF_cache_thread_changed] DEFAULT (getdate()) FOR [changed]  
101 -GO  
102 -  
103 -CREATE INDEX [IX_cache_thread_user_id] ON [dbo].[cache_thread]([user_id]) ON [PRIMARY]  
104 -GO  
105 -  
106 -ALTER TABLE [dbo].[cache_messages] ADD  
107 - CONSTRAINT [DF_cache_messages_changed] DEFAULT (getdate()) FOR [changed],  
108 - CONSTRAINT [DF_cache_messages_flags] DEFAULT (0) FOR [flags]  
109 -GO  
110 -  
111 -CREATE INDEX [IX_cache_messages_user_id] ON [dbo].[cache_messages]([user_id]) ON [PRIMARY]  
112 -GO  
113 -  
114 -ALTER TABLE [dbo].[cache_index] ADD CONSTRAINT [FK_cache_index_user_id]  
115 - FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])  
116 - ON DELETE CASCADE ON UPDATE CASCADE  
117 -GO  
118 -  
119 -ALTER TABLE [dbo].[cache_thread] ADD CONSTRAINT [FK_cache_thread_user_id]  
120 - FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])  
121 - ON DELETE CASCADE ON UPDATE CASCADE  
122 -GO  
123 -  
124 -ALTER TABLE [dbo].[cache_messages] ADD CONSTRAINT [FK_cache_messages_user_id]  
125 - FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])  
126 - ON DELETE CASCADE ON UPDATE CASCADE  
127 -GO  
1 --- Updates from version 0.7-beta  
2 -  
3 -ALTER TABLE [dbo].[session] ALTER COLUMN [sess_id] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL  
4 -GO  
1 --- Updates from version 0.7  
2 -  
3 -ALTER TABLE [dbo].[contacts] DROP CONSTRAINT [DF_contacts_email]  
4 -GO  
5 -ALTER TABLE [dbo].[contacts] ALTER COLUMN [email] [text] COLLATE Latin1_General_CI_AI NOT NULL  
6 -GO  
7 -ALTER TABLE [dbo].[contacts] ADD CONSTRAINT [DF_contacts_email] DEFAULT ('') FOR [email]  
8 -GO  
9 -  
1 --- Updates from version 0.8-rc  
2 -  
3 -ALTER TABLE [dbo].[contacts] DROP CONSTRAINT [DF_contacts_email]  
4 -GO  
5 -ALTER TABLE [dbo].[contacts] ALTER COLUMN [email] [varchar] (8000) COLLATE Latin1_General_CI_AI NOT NULL  
6 -GO  
7 -ALTER TABLE [dbo].[contacts] ADD CONSTRAINT [DF_contacts_email] DEFAULT ('') FOR [email]  
8 -GO  
9 -  
10 --- Updates from version 0.8  
11 -  
12 -ALTER TABLE [dbo].[cache] DROP COLUMN [cache_id]  
13 -GO  
14 -ALTER TABLE [dbo].[users] DROP COLUMN [alias]  
15 -GO  
16 -CREATE INDEX [IX_identities_email] ON [dbo].[identities]([email],[del]) ON [PRIMARY]  
17 -GO  
18 -  
1 --- Updates from version 0.8  
2 -  
3 -ALTER TABLE [dbo].[cache] DROP COLUMN [cache_id]  
4 -GO  
5 -ALTER TABLE [dbo].[users] DROP COLUMN [alias]  
6 -GO  
7 -CREATE INDEX [IX_identities_email] ON [dbo].[identities]([email],[del]) ON [PRIMARY]  
8 -GO  
1 --- Upgrades from 0.9-beta  
2 -  
3 -CREATE TABLE [dbo].[system] (  
4 - [name] [varchar] (64) COLLATE Latin1_General_CI_AI NOT NULL ,  
5 - [value] [text] COLLATE Latin1_General_CI_AI  
6 -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]  
7 -GO  
8 -  
9 -ALTER TABLE [dbo].[system] WITH NOCHECK ADD  
10 - CONSTRAINT [PK_system_name] PRIMARY KEY CLUSTERED  
11 - (  
12 - [name]  
13 - ) ON [PRIMARY]  
14 -GO  
1 -CREATE TABLE [dbo].[cache_shared] (  
2 - [cache_key] [varchar] (255) COLLATE Latin1_General_CI_AI NOT NULL ,  
3 - [created] [datetime] NOT NULL ,  
4 - [data] [text] COLLATE Latin1_General_CI_AI NOT NULL  
5 -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]  
6 -GO  
7 -  
8 -ALTER TABLE [dbo].[cache_shared] ADD  
9 - CONSTRAINT [DF_cache_shared_created] DEFAULT (getdate()) FOR [created]  
10 -GO  
11 -  
12 -CREATE INDEX [IX_cache_shared_cache_key] ON [dbo].[cache_shared]([cache_key]) ON [PRIMARY]  
13 -GO  
14 -  
15 -CREATE INDEX [IX_cache_shared_created] ON [dbo].[cache_shared]([created]) ON [PRIMARY]  
16 -GO  
17 -  
1 -ALTER TABLE [dbo].[cache] ADD [expires] [datetime] NULL  
2 -GO  
3 -ALTER TABLE [dbo].[cache_shared] ADD [expires] [datetime] NULL  
4 -GO  
5 -ALTER TABLE [dbo].[cache_index] ADD [expires] [datetime] NULL  
6 -GO  
7 -ALTER TABLE [dbo].[cache_thread] ADD [expires] [datetime] NULL  
8 -GO  
9 -ALTER TABLE [dbo].[cache_messages] ADD [expires] [datetime] NULL  
10 -GO  
11 -  
12 -UPDATE [dbo].[cache] SET [expires] = DATEADD(second, 604800, [created])  
13 -GO  
14 -UPDATE [dbo].[cache_shared] SET [expires] = DATEADD(second, 604800, [created])  
15 -GO  
16 -UPDATE [dbo].[cache_index] SET [expires] = DATEADD(second, 604800, [changed])  
17 -GO  
18 -UPDATE [dbo].[cache_thread] SET [expires] = DATEADD(second, 604800, [changed])  
19 -GO  
20 -UPDATE [dbo].[cache_messages] SET [expires] = DATEADD(second, 604800, [changed])  
21 -GO  
22 -  
23 -DROP INDEX [IX_cache_created]  
24 -GO  
25 -DROP INDEX [IX_cache_shared_created]  
26 -GO  
27 -ALTER TABLE [dbo].[cache_index] DROP COLUMN [changed]  
28 -GO  
29 -ALTER TABLE [dbo].[cache_thread] DROP COLUMN [changed]  
30 -GO  
31 -ALTER TABLE [dbo].[cache_messages] DROP COLUMN [changed]  
32 -GO  
33 -  
34 -CREATE INDEX [IX_cache_expires] ON [dbo].[cache]([expires]) ON [PRIMARY]  
35 -GO  
36 -CREATE INDEX [IX_cache_shared_expires] ON [dbo].[cache_shared]([expires]) ON [PRIMARY]  
37 -GO  
38 -CREATE INDEX [IX_cache_index_expires] ON [dbo].[cache_index]([expires]) ON [PRIMARY]  
39 -GO  
40 -CREATE INDEX [IX_cache_thread_expires] ON [dbo].[cache_thread]([expires]) ON [PRIMARY]  
41 -GO  
42 -CREATE INDEX [IX_cache_messages_expires] ON [dbo].[cache_messages]([expires]) ON [PRIMARY]  
43 -GO  
44 -  
1 -ALTER TABLE [dbo].[users] ADD [failed_login] [datetime] NULL  
2 -GO  
3 -ALTER TABLE [dbo].[users] ADD [failed_login_counter] [int] NULL  
4 -GO  
1 -ALTER TABLE [dbo].[session] DROP CONSTRAINT [DF_session_created]  
2 -GO  
3 -  
4 -ALTER TABLE [dbo].[session] DROP COLUMN [created]  
5 -GO  
1 -ALTER TABLE [dbo].[session] ALTER COLUMN [ip] [varchar] (40) COLLATE Latin1_General_CI_AI NOT NULL  
2 -GO  
1 -DROP TABLE [dbo].[cache]  
2 -GO  
3 -DROP TABLE [dbo].[cache_shared]  
4 -GO  
5 -  
6 -CREATE TABLE [dbo].[cache] (  
7 - [user_id] [int] NOT NULL ,  
8 - [cache_key] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,  
9 - [expires] [datetime] NULL ,  
10 - [data] [text] COLLATE Latin1_General_CI_AI NOT NULL  
11 -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]  
12 -GO  
13 -CREATE TABLE [dbo].[cache_shared] (  
14 - [cache_key] [varchar] (255) COLLATE Latin1_General_CI_AI NOT NULL ,  
15 - [expires] [datetime] NULL ,  
16 - [data] [text] COLLATE Latin1_General_CI_AI NOT NULL  
17 -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]  
18 -GO  
19 -ALTER TABLE [dbo].[cache] ADD  
20 - CONSTRAINT [DF_cache_user_id] DEFAULT ('0') FOR [user_id],  
21 - CONSTRAINT [DF_cache_cache_key] DEFAULT ('') FOR [cache_key]  
22 -GO  
23 -CREATE INDEX [IX_cache_expires] ON [dbo].[cache]([expires]) ON [PRIMARY]  
24 -GO  
25 -CREATE INDEX [IX_cache_shared_expires] ON [dbo].[cache_shared]([expires]) ON [PRIMARY]  
26 -GO  
27 -ALTER TABLE [dbo].[cache] WITH NOCHECK ADD  
28 - PRIMARY KEY CLUSTERED (  
29 - [user_id],[cache_key]  
30 - ) ON [PRIMARY]  
31 -GO  
32 -ALTER TABLE [dbo].[cache_shared] WITH NOCHECK ADD  
33 - PRIMARY KEY CLUSTERED (  
34 - [cache_key]  
35 - ) ON [PRIMARY]  
36 -GO  
1 -CREATE TABLE [dbo].[filestore] (  
2 - [file_id] [int] IDENTITY (1, 1) NOT NULL ,  
3 - [user_id] [int] NOT NULL ,  
4 - [filename] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,  
5 - [mtime] [int] NOT NULL ,  
6 - [data] [text] COLLATE Latin1_General_CI_AI NULL ,  
7 -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]  
8 -GO  
9 -  
10 -ALTER TABLE [dbo].[filestore] WITH NOCHECK ADD  
11 - CONSTRAINT [PK_filestore_file_id] PRIMARY KEY CLUSTERED  
12 - (  
13 - [file_id]  
14 - ) ON [PRIMARY]  
15 -GO  
16 -  
17 -CREATE INDEX [IX_filestore_user_id] ON [dbo].[filestore]([user_id]) ON [PRIMARY]  
18 -GO  
19 -  
20 -ALTER TABLE [dbo].[filestore] ADD CONSTRAINT [FK_filestore_user_id]  
21 - FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])  
22 - ON DELETE CASCADE ON UPDATE CASCADE  
23 -GO  
24 -  
1 -ALTER TABLE [dbo].[filestore] ADD [context] varchar(32) COLLATE Latin1_General_CI_AI NOT NULL  
2 -GO  
3 -  
4 -UPDATE [dbo].[filestore] SET [context] = 'enigma'  
5 -GO  
6 -  
7 -CREATE UNIQUE INDEX [IX_filestore_user_id_context_filename] ON [dbo].[filestore]([user_id],[context],[filename]) ON [PRIMARY]  
8 -GO  
9 -  
1 -ALTER TABLE [dbo].[cache] ALTER COLUMN  
2 - [cache_key] [varchar] (128) COLLATE Latin1_General_CS_AS NOT NULL  
3 -GO  
4 -ALTER TABLE [dbo].[cache_shared] ALTER COLUMN  
5 - [cache_key] [varchar] (255) COLLATE Latin1_General_CS_AS NOT NULL  
6 -GO  
7 -ALTER TABLE [dbo].[cache_index] ALTER COLUMN  
8 - [mailbox] [varchar] (128) COLLATE Latin1_General_CS_AS NOT NULL  
9 -GO  
10 -ALTER TABLE [dbo].[cache_messages] ALTER COLUMN  
11 - [mailbox] [varchar] (128) COLLATE Latin1_General_CS_AS NOT NULL  
12 -GO  
13 -ALTER TABLE [dbo].[cache_thread] ALTER COLUMN  
14 - [mailbox] [varchar] (128) COLLATE Latin1_General_CS_AS NOT NULL  
15 -GO  
16 -ALTER TABLE [dbo].[users] ALTER COLUMN  
17 - [username] [varchar] (128) COLLATE Latin1_General_CS_AS NOT NULL  
18 -GO  
1 -ALTER TABLE [dbo].[users] ALTER COLUMN [language] [varchar] (16) COLLATE Latin1_General_CI_AI NULL  
2 -GO  
3 -ALTER TABLE [dbo].[dictionary] ALTER COLUMN [language] [varchar] (16) COLLATE Latin1_General_CI_AI NOT NULL  
4 -GO  
1 -CREATE TABLE [dbo].[collected_addresses] (  
2 - [address_id] [int] IDENTITY (1, 1) NOT NULL ,  
3 - [user_id] [int] NOT NULL ,  
4 - [changed] [datetime] NOT NULL ,  
5 - [name] [varchar] (255) COLLATE Latin1_General_CI_AI NOT NULL ,  
6 - [email] [varchar] (255) COLLATE Latin1_General_CI_AI NOT NULL ,  
7 - [type] [int] NOT NULL  
8 -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]  
9 -GO  
10 -  
11 -ALTER TABLE [dbo].[collected_addresses] WITH NOCHECK ADD  
12 - CONSTRAINT [PK_collected_addresses_address_id] PRIMARY KEY CLUSTERED  
13 - (  
14 - [address_id]  
15 - ) ON [PRIMARY]  
16 -GO  
17 -  
18 -ALTER TABLE [dbo].[collected_addresses] ADD  
19 - CONSTRAINT [DF_collected_addresses_user_id] DEFAULT (0) FOR [user_id],  
20 - CONSTRAINT [DF_collected_addresses_changed] DEFAULT (getdate()) FOR [changed],  
21 - CONSTRAINT [DF_collected_addresses_name] DEFAULT ('') FOR [name],  
22 -GO  
23 -  
24 -CREATE UNIQUE INDEX [IX_collected_addresses_user_id] ON [dbo].[collected_addresses]([user_id],[type],[email]) ON [PRIMARY]  
25 -GO  
26 -  
27 -ALTER TABLE [dbo].[collected_addresses] ADD CONSTRAINT [FK_collected_addresses_user_id]  
28 - FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])  
29 - ON DELETE CASCADE ON UPDATE CASCADE  
30 -GO  
31 -  
@@ -23,8 +23,8 @@ CREATE TABLE `users` ( @@ -23,8 +23,8 @@ CREATE TABLE `users` (
23 `mail_host` varchar(128) NOT NULL, 23 `mail_host` varchar(128) NOT NULL,
24 `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', 24 `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
25 `last_login` datetime DEFAULT NULL, 25 `last_login` datetime DEFAULT NULL,
26 - `failed_login` datetime DEFAULT NULL,  
27 - `failed_login_counter` int(10) UNSIGNED DEFAULT NULL, 26 + `failed_login` datetime DEFAULT NULL COMMENT '最后尝试登录的时间',
  27 + `failed_login_counter` int(10) unsigned DEFAULT NULL COMMENT '尝试登录的次数,和login_rate_limit配置相关,多少时间内不能超过次',
28 `language` varchar(16), 28 `language` varchar(16),
29 `preferences` longtext, 29 `preferences` longtext,
30 PRIMARY KEY(`user_id`), 30 PRIMARY KEY(`user_id`),
@@ -241,9 +241,8 @@ CREATE TABLE `system` ( @@ -241,9 +241,8 @@ CREATE TABLE `system` (
241 PRIMARY KEY(`name`) 241 PRIMARY KEY(`name`)
242 ) ROW_FORMAT=DYNAMIC ENGINE=INNODB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; 242 ) ROW_FORMAT=DYNAMIC ENGINE=INNODB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
243 243
244 -SET FOREIGN_KEY_CHECKS=1;  
245 244
246 -INSERT INTO `system` (`name`, `value`) VALUES ('roundcube-version', '2020122900'); 245 +-- Table structure for table `email_server_address`
247 246
248 CREATE TABLE `email_server_address` ( 247 CREATE TABLE `email_server_address` (
249 `id` int(10) unsigned NOT NULL AUTO_INCREMENT, 248 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -255,6 +254,9 @@ PRIMARY KEY (`id`), @@ -255,6 +254,9 @@ PRIMARY KEY (`id`),
255 KEY `mail_suffix` (`mail_suffix`) 254 KEY `mail_suffix` (`mail_suffix`)
256 ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COMMENT='email服务器地址'; 255 ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COMMENT='email服务器地址';
257 256
  257 +
  258 +-- Table structure for table `platform_users`
  259 +
258 CREATE TABLE `platform_users` ( 260 CREATE TABLE `platform_users` (
259 `id` int(10) unsigned NOT NULL AUTO_INCREMENT, 261 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
260 `platform_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT ' platform 表id', 262 `platform_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT ' platform 表id',
@@ -265,6 +267,8 @@ CREATE TABLE `platform_users` ( @@ -265,6 +267,8 @@ CREATE TABLE `platform_users` (
265 KEY `platform` (`platform_id`,`platform_user_id`,`user_id`) USING BTREE 267 KEY `platform` (`platform_id`,`platform_user_id`,`user_id`) USING BTREE
266 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='接入平台,用户关系表'; 268 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='接入平台,用户关系表';
267 269
  270 +-- Table structure for table `platform`
  271 +
268 CREATE TABLE `platform` ( 272 CREATE TABLE `platform` (
269 `id` int(10) unsigned NOT NULL AUTO_INCREMENT, 273 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
270 `name` varchar(20) NOT NULL DEFAULT '' COMMENT '那个平台', 274 `name` varchar(20) NOT NULL DEFAULT '' COMMENT '那个平台',
@@ -275,3 +279,14 @@ CREATE TABLE `platform` ( @@ -275,3 +279,14 @@ CREATE TABLE `platform` (
275 PRIMARY KEY (`id`), 279 PRIMARY KEY (`id`),
276 UNIQUE KEY `appid` (`appid`) 280 UNIQUE KEY `appid` (`appid`)
277 ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='平台'; 281 ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='平台';
  282 +
  283 +
  284 +SET FOREIGN_KEY_CHECKS=1;
  285 +
  286 +
  287 +-- Insert data
  288 +
  289 +INSERT INTO `system` (`name`, `value`) VALUES ('roundcube-version', '2020122900');
  290 +
  291 +INSERT INTO `roundcubemail`.`email_server_address`(`id`, `mail_suffix`, `imap`, `smtp`, `service_provider`) VALUES (1, 'qq.com', 'imap.qq.com', 'smtp.qq.com', 'QQ邮箱');
  292 +INSERT INTO `roundcubemail`.`email_server_address`(`id`, `mail_suffix`, `imap`, `smtp`, `service_provider`) VALUES (2, 'gmail.com', 'imap.gmail.com', 'smtp.gmail.com', 'Gmail 谷歌');
1 --- Roundcube Webmail initial database structure  
2 --- This was tested with Oracle 11g  
3 -  
4 -CREATE TABLE "users" (  
5 - "user_id" integer PRIMARY KEY,  
6 - "username" varchar(128) NOT NULL,  
7 - "mail_host" varchar(128) NOT NULL,  
8 - "created" timestamp with time zone DEFAULT current_timestamp NOT NULL,  
9 - "last_login" timestamp with time zone DEFAULT NULL,  
10 - "failed_login" timestamp with time zone DEFAULT NULL,  
11 - "failed_login_counter" integer DEFAULT NULL,  
12 - "language" varchar(16),  
13 - "preferences" long DEFAULT NULL,  
14 - CONSTRAINT "users_username_key" UNIQUE ("username", "mail_host")  
15 -);  
16 -  
17 -CREATE SEQUENCE "users_seq"  
18 - START WITH 1 INCREMENT BY 1 NOMAXVALUE;  
19 -  
20 -CREATE TRIGGER "users_seq_trig"  
21 -BEFORE INSERT ON "users" FOR EACH ROW  
22 -BEGIN  
23 - :NEW."user_id" := "users_seq".nextval;  
24 -END;  
25 -/  
26 -  
27 -CREATE TABLE "session" (  
28 - "sess_id" varchar(128) NOT NULL PRIMARY KEY,  
29 - "changed" timestamp with time zone DEFAULT current_timestamp NOT NULL,  
30 - "ip" varchar(41) NOT NULL,  
31 - "vars" long NOT NULL  
32 -);  
33 -  
34 -CREATE INDEX "session_changed_idx" ON "session" ("changed");  
35 -  
36 -  
37 -CREATE TABLE "identities" (  
38 - "identity_id" integer PRIMARY KEY,  
39 - "user_id" integer NOT NULL  
40 - REFERENCES "users" ("user_id") ON DELETE CASCADE,  
41 - "changed" timestamp with time zone DEFAULT current_timestamp NOT NULL,  
42 - "del" smallint DEFAULT 0 NOT NULL,  
43 - "standard" smallint DEFAULT 0 NOT NULL,  
44 - "name" varchar(128) NOT NULL,  
45 - "organization" varchar(128),  
46 - "email" varchar(128) NOT NULL,  
47 - "reply-to" varchar(128),  
48 - "bcc" varchar(128),  
49 - "signature" long,  
50 - "html_signature" integer DEFAULT 0 NOT NULL  
51 -);  
52 -  
53 -CREATE INDEX "identities_user_id_idx" ON "identities" ("user_id", "del");  
54 -CREATE INDEX "identities_email_idx" ON "identities" ("email", "del");  
55 -  
56 -CREATE SEQUENCE "identities_seq"  
57 - START WITH 1 INCREMENT BY 1 NOMAXVALUE;  
58 -  
59 -CREATE TRIGGER "identities_seq_trig"  
60 -BEFORE INSERT ON "identities" FOR EACH ROW  
61 -BEGIN  
62 - :NEW."identity_id" := "identities_seq".nextval;  
63 -END;  
64 -/  
65 -  
66 -CREATE TABLE "collected_addresses" (  
67 - "address_id" integer PRIMARY KEY,  
68 - "user_id" integer NOT NULL  
69 - REFERENCES "users" ("user_id") ON DELETE CASCADE,  
70 - "changed" timestamp with time zone DEFAULT current_timestamp NOT NULL,  
71 - "name" varchar(255) DEFAULT NULL,  
72 - "email" varchar(255) DEFAULT NULL,  
73 - "type" integer NOT NULL  
74 -);  
75 -  
76 -CREATE UNIQUE INDEX "collected_addresses_user_id_idx" ON "collected_addresses" ("user_id", "type", "email");  
77 -  
78 -CREATE SEQUENCE "collected_addresses_seq"  
79 - START WITH 1 INCREMENT BY 1 NOMAXVALUE;  
80 -  
81 -CREATE TRIGGER "collected_addresses_seq_trig"  
82 -BEFORE INSERT ON "collected_addresses" FOR EACH ROW  
83 -BEGIN  
84 - :NEW."address_id" := "collected_addresses_seq".nextval;  
85 -END;  
86 -/  
87 -  
88 -CREATE TABLE "contacts" (  
89 - "contact_id" integer PRIMARY KEY,  
90 - "user_id" integer NOT NULL  
91 - REFERENCES "users" ("user_id") ON DELETE CASCADE,  
92 - "changed" timestamp with time zone DEFAULT current_timestamp NOT NULL,  
93 - "del" smallint DEFAULT 0 NOT NULL,  
94 - "name" varchar(128) DEFAULT NULL,  
95 - "email" varchar(4000) DEFAULT NULL,  
96 - "firstname" varchar(128) DEFAULT NULL,  
97 - "surname" varchar(128) DEFAULT NULL,  
98 - "vcard" long,  
99 - "words" varchar(4000)  
100 -);  
101 -  
102 -CREATE INDEX "contacts_user_id_idx" ON "contacts" ("user_id", "del");  
103 -  
104 -CREATE SEQUENCE "contacts_seq"  
105 - START WITH 1 INCREMENT BY 1 NOMAXVALUE;  
106 -  
107 -CREATE TRIGGER "contacts_seq_trig"  
108 -BEFORE INSERT ON "contacts" FOR EACH ROW  
109 -BEGIN  
110 - :NEW."contact_id" := "contacts_seq".nextval;  
111 -END;  
112 -/  
113 -  
114 -CREATE TABLE "contactgroups" (  
115 - "contactgroup_id" integer PRIMARY KEY,  
116 - "user_id" integer NOT NULL  
117 - REFERENCES "users" ("user_id") ON DELETE CASCADE,  
118 - "changed" timestamp with time zone DEFAULT current_timestamp NOT NULL,  
119 - "del" smallint DEFAULT 0 NOT NULL,  
120 - "name" varchar(128) NOT NULL  
121 -);  
122 -  
123 -CREATE INDEX "contactgroups_user_id_idx" ON "contactgroups" ("user_id", "del");  
124 -  
125 -CREATE SEQUENCE "contactgroups_seq"  
126 - START WITH 1 INCREMENT BY 1 NOMAXVALUE;  
127 -  
128 -CREATE TRIGGER "contactgroups_seq_trig"  
129 -BEFORE INSERT ON "contactgroups" FOR EACH ROW  
130 -BEGIN  
131 - :NEW."contactgroup_id" := "contactgroups_seq".nextval;  
132 -END;  
133 -/  
134 -  
135 -CREATE TABLE "contactgroupmembers" (  
136 - "contactgroup_id" integer NOT NULL  
137 - REFERENCES "contactgroups" ("contactgroup_id") ON DELETE CASCADE,  
138 - "contact_id" integer NOT NULL  
139 - REFERENCES "contacts" ("contact_id") ON DELETE CASCADE,  
140 - "created" timestamp with time zone DEFAULT current_timestamp NOT NULL,  
141 - PRIMARY KEY ("contactgroup_id", "contact_id")  
142 -);  
143 -  
144 -CREATE INDEX "contactgroupmembers_idx" ON "contactgroupmembers" ("contact_id");  
145 -  
146 -  
147 -CREATE TABLE "cache" (  
148 - "user_id" integer NOT NULL  
149 - REFERENCES "users" ("user_id") ON DELETE CASCADE,  
150 - "cache_key" varchar(128) NOT NULL,  
151 - "expires" timestamp with time zone DEFAULT NULL,  
152 - "data" long NOT NULL,  
153 - PRIMARY KEY ("user_id", "cache_key")  
154 -);  
155 -  
156 -CREATE INDEX "cache_expires_idx" ON "cache" ("expires");  
157 -  
158 -  
159 -CREATE TABLE "cache_shared" (  
160 - "cache_key" varchar(255) NOT NULL,  
161 - "expires" timestamp with time zone DEFAULT NULL,  
162 - "data" long NOT NULL,  
163 - PRIMARY KEY ("cache_key")  
164 -);  
165 -  
166 -CREATE INDEX "cache_shared_expires_idx" ON "cache_shared" ("expires");  
167 -  
168 -  
169 -CREATE TABLE "cache_index" (  
170 - "user_id" integer NOT NULL  
171 - REFERENCES "users" ("user_id") ON DELETE CASCADE,  
172 - "mailbox" varchar(255) NOT NULL,  
173 - "expires" timestamp with time zone DEFAULT NULL,  
174 - "valid" smallint DEFAULT 0 NOT NULL,  
175 - "data" long NOT NULL,  
176 - PRIMARY KEY ("user_id", "mailbox")  
177 -);  
178 -  
179 -CREATE INDEX "cache_index_expires_idx" ON "cache_index" ("expires");  
180 -  
181 -  
182 -CREATE TABLE "cache_thread" (  
183 - "user_id" integer NOT NULL  
184 - REFERENCES "users" ("user_id") ON DELETE CASCADE,  
185 - "mailbox" varchar(255) NOT NULL,  
186 - "expires" timestamp with time zone DEFAULT NULL,  
187 - "data" long NOT NULL,  
188 - PRIMARY KEY ("user_id", "mailbox")  
189 -);  
190 -  
191 -CREATE INDEX "cache_thread_expires_idx" ON "cache_thread" ("expires");  
192 -  
193 -  
194 -CREATE TABLE "cache_messages" (  
195 - "user_id" integer NOT NULL  
196 - REFERENCES "users" ("user_id") ON DELETE CASCADE,  
197 - "mailbox" varchar(255) NOT NULL,  
198 - "uid" integer NOT NULL,  
199 - "expires" timestamp with time zone DEFAULT NULL,  
200 - "data" long NOT NULL,  
201 - "flags" integer DEFAULT 0 NOT NULL,  
202 - PRIMARY KEY ("user_id", "mailbox", "uid")  
203 -);  
204 -  
205 -CREATE INDEX "cache_messages_expires_idx" ON "cache_messages" ("expires");  
206 -  
207 -  
208 -CREATE TABLE "dictionary" (  
209 - "user_id" integer DEFAULT NULL  
210 - REFERENCES "users" ("user_id") ON DELETE CASCADE,  
211 - "language" varchar(16) NOT NULL,  
212 - "data" long DEFAULT NULL,  
213 - CONSTRAINT "dictionary_user_id_lang_key" UNIQUE ("user_id", "language")  
214 -);  
215 -  
216 -  
217 -CREATE TABLE "searches" (  
218 - "search_id" integer PRIMARY KEY,  
219 - "user_id" integer NOT NULL  
220 - REFERENCES "users" ("user_id") ON DELETE CASCADE,  
221 - "type" smallint DEFAULT 0 NOT NULL,  
222 - "name" varchar(128) NOT NULL,  
223 - "data" long NOT NULL,  
224 - CONSTRAINT "searches_user_id_key" UNIQUE ("user_id", "type", "name")  
225 -);  
226 -  
227 -CREATE SEQUENCE "searches_seq"  
228 - START WITH 1 INCREMENT BY 1 NOMAXVALUE;  
229 -  
230 -CREATE TRIGGER "searches_seq_trig"  
231 -BEFORE INSERT ON "searches" FOR EACH ROW  
232 -BEGIN  
233 - :NEW."search_id" := "searches_seq".nextval;  
234 -END;  
235 -/  
236 -  
237 -CREATE TABLE "filestore" (  
238 - "file_id" integer PRIMARY KEY,  
239 - "user_id" integer NOT NULL  
240 - REFERENCES "users" ("user_id") ON DELETE CASCADE ON UPDATE CASCADE,  
241 - "context" varchar(32) NOT NULL,  
242 - "filename" varchar(128) NOT NULL,  
243 - "mtime" integer NOT NULL,  
244 - "data" long,  
245 - CONSTRAINT "filestore_user_id_key" UNIQUE ("user_id", "context", "filename")  
246 -);  
247 -  
248 -CREATE SEQUENCE "filestore_seq"  
249 - START WITH 1 INCREMENT BY 1 NOMAXVALUE;  
250 -  
251 -CREATE TRIGGER "filestore_seq_trig"  
252 -BEFORE INSERT ON "filestore" FOR EACH ROW  
253 -BEGIN  
254 - :NEW."user_id" := "filestore_seq".nextval;  
255 -END;  
256 -/  
257 -  
258 -CREATE TABLE "system" (  
259 - "name" varchar(64) NOT NULL PRIMARY KEY,  
260 - "value" long  
261 -);  
262 -  
263 -INSERT INTO "system" ("name", "value") VALUES ('roundcube-version', '2020122900');  
1 -ALTER TABLE "users" ADD "failed_login" timestamp with time zone DEFAULT NULL;  
2 -ALTER TABLE "users" ADD "failed_login_counter" integer DEFAULT NULL;  
1 -ALTER TABLE "session" DROP COLUMN "created";  
1 -ALTER TABLE "session" MODIFY "ip" varchar(41) NOT NULL;  
1 -DROP TABLE "cache";  
2 -DROP TABLE "cache_shared";  
3 -  
4 -CREATE TABLE "cache" (  
5 - "user_id" integer NOT NULL  
6 - REFERENCES "users" ("user_id") ON DELETE CASCADE,  
7 - "cache_key" varchar(128) NOT NULL,  
8 - "expires" timestamp with time zone DEFAULT NULL,  
9 - "data" long NOT NULL,  
10 - PRIMARY KEY ("user_id", "cache_key")  
11 -);  
12 -  
13 -CREATE INDEX "cache_expires_idx" ON "cache" ("expires");  
14 -  
15 -  
16 -CREATE TABLE "cache_shared" (  
17 - "cache_key" varchar(255) NOT NULL,  
18 - "expires" timestamp with time zone DEFAULT NULL,  
19 - "data" long NOT NULL,  
20 - PRIMARY KEY ("cache_key")  
21 -);  
22 -  
23 -CREATE INDEX "cache_shared_expires_idx" ON "cache_shared" ("expires");  
1 -CREATE TABLE "filestore" (  
2 - "file_id" integer PRIMARY KEY,  
3 - "user_id" integer NOT NULL  
4 - REFERENCES "users" ("user_id") ON DELETE CASCADE ON UPDATE CASCADE,  
5 - "filename" varchar(128) NOT NULL,  
6 - "mtime" integer NOT NULL,  
7 - "data" long,  
8 - CONSTRAINT "filestore_user_id_key" UNIQUE ("user_id", "filename")  
9 -);  
10 -  
11 -CREATE SEQUENCE "filestore_seq"  
12 - START WITH 1 INCREMENT BY 1 NOMAXVALUE;  
13 -  
14 -CREATE TRIGGER "filestore_seq_trig"  
15 -BEFORE INSERT ON "filestore" FOR EACH ROW  
16 -BEGIN  
17 - :NEW."user_id" := "filestore_seq".nextval;  
18 -END;  
19 -/  
1 -ALTER TABLE "filestore" ADD COLUMN "context" varchar(32) NOT NULL;  
2 -UPDATE "filestore" SET "context" = 'enigma';  
3 -ALTER TABLE "filestore" DROP CONSTRAINT "filestore_user_id_key";  
4 -ALTER TABLE "filestore" ADD CONSTRAINT "filestore_user_id_key" UNIQUE ("user_id", "context", "filename");  
1 -ALTER TABLE "users" MODIFY "language" varchar(16) NOT NULL;  
2 -ALTER TABLE "dictionary" MODIFY "language" varchar(16);  
1 -CREATE TABLE "collected_addresses" (  
2 - "address_id" integer PRIMARY KEY,  
3 - "user_id" integer NOT NULL  
4 - REFERENCES "users" ("user_id") ON DELETE CASCADE,  
5 - "changed" timestamp with time zone DEFAULT current_timestamp NOT NULL,  
6 - "name" varchar(255) DEFAULT NULL,  
7 - "email" varchar(255) DEFAULT NULL,  
8 - "type" integer NOT NULL  
9 -);  
10 -  
11 -CREATE UNIQUE INDEX "collected_addresses_user_id_idx" ON "collected_addresses" ("user_id", "type", "email");  
12 -  
13 -CREATE SEQUENCE "collected_addresses_seq"  
14 - START WITH 1 INCREMENT BY 1 NOMAXVALUE;  
15 -  
16 -CREATE TRIGGER "collected_addresses_seq_trig"  
17 -BEFORE INSERT ON "collected_addresses" FOR EACH ROW  
18 -BEGIN  
19 - :NEW."address_id" := "collected_addresses_seq".nextval;  
20 -END;  
21 -/  
1 --- Roundcube Webmail initial database structure  
2 -  
3 ---  
4 --- Sequence "users_seq"  
5 --- Name: users_seq; Type: SEQUENCE; Schema: public; Owner: postgres  
6 ---  
7 -  
8 -CREATE SEQUENCE users_seq  
9 - INCREMENT BY 1  
10 - NO MAXVALUE  
11 - NO MINVALUE  
12 - CACHE 1;  
13 -  
14 ---  
15 --- Table "users"  
16 --- Name: users; Type: TABLE; Schema: public; Owner: postgres  
17 ---  
18 -  
19 -CREATE TABLE users (  
20 - user_id integer DEFAULT nextval('users_seq'::text) PRIMARY KEY,  
21 - username varchar(128) DEFAULT '' NOT NULL,  
22 - mail_host varchar(128) DEFAULT '' NOT NULL,  
23 - created timestamp with time zone DEFAULT now() NOT NULL,  
24 - last_login timestamp with time zone DEFAULT NULL,  
25 - failed_login timestamp with time zone DEFAULT NULL,  
26 - failed_login_counter integer DEFAULT NULL,  
27 - "language" varchar(16),  
28 - preferences text DEFAULT NULL,  
29 - CONSTRAINT users_username_key UNIQUE (username, mail_host)  
30 -);  
31 -  
32 -  
33 ---  
34 --- Table "session"  
35 --- Name: session; Type: TABLE; Schema: public; Owner: postgres  
36 ---  
37 -  
38 -CREATE TABLE "session" (  
39 - sess_id varchar(128) DEFAULT '' PRIMARY KEY,  
40 - changed timestamp with time zone DEFAULT now() NOT NULL,  
41 - ip varchar(41) NOT NULL,  
42 - vars text NOT NULL  
43 -);  
44 -  
45 -CREATE INDEX session_changed_idx ON session (changed);  
46 -  
47 -  
48 ---  
49 --- Sequence "identities_seq"  
50 --- Name: identities_seq; Type: SEQUENCE; Schema: public; Owner: postgres  
51 ---  
52 -  
53 -CREATE SEQUENCE identities_seq  
54 - START WITH 1  
55 - INCREMENT BY 1  
56 - NO MAXVALUE  
57 - NO MINVALUE  
58 - CACHE 1;  
59 -  
60 ---  
61 --- Table "identities"  
62 --- Name: identities; Type: TABLE; Schema: public; Owner: postgres  
63 ---  
64 -  
65 -CREATE TABLE identities (  
66 - identity_id integer DEFAULT nextval('identities_seq'::text) PRIMARY KEY,  
67 - user_id integer NOT NULL  
68 - REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,  
69 - changed timestamp with time zone DEFAULT now() NOT NULL,  
70 - del smallint DEFAULT 0 NOT NULL,  
71 - standard smallint DEFAULT 0 NOT NULL,  
72 - name varchar(128) NOT NULL,  
73 - organization varchar(128),  
74 - email varchar(128) NOT NULL,  
75 - "reply-to" varchar(128),  
76 - bcc varchar(128),  
77 - signature text,  
78 - html_signature integer DEFAULT 0 NOT NULL  
79 -);  
80 -  
81 -CREATE INDEX identities_user_id_idx ON identities (user_id, del);  
82 -CREATE INDEX identities_email_idx ON identities (email, del);  
83 -  
84 ---  
85 --- Sequence "collected_addresses_seq"  
86 --- Name: collected_addresses_seq; Type: SEQUENCE; Schema: public; Owner: postgres  
87 ---  
88 -  
89 -CREATE SEQUENCE collected_addresses_seq  
90 - START WITH 1  
91 - INCREMENT BY 1  
92 - NO MAXVALUE  
93 - NO MINVALUE  
94 - CACHE 1;  
95 -  
96 ---  
97 --- Table "collected_addresses"  
98 --- Name: collected_addresses; Type: TABLE; Schema: public; Owner: postgres  
99 ---  
100 -  
101 -CREATE TABLE collected_addresses (  
102 - address_id integer DEFAULT nextval('collected_addresses_seq'::text) PRIMARY KEY,  
103 - user_id integer NOT NULL  
104 - REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,  
105 - changed timestamp with time zone DEFAULT now() NOT NULL,  
106 - name varchar(255) DEFAULT '' NOT NULL,  
107 - email varchar(255) NOT NULL,  
108 - "type" integer NOT NULL  
109 -);  
110 -  
111 -CREATE UNIQUE INDEX collected_addresses_user_id_idx ON collected_addresses (user_id, "type", email);  
112 -  
113 -  
114 ---  
115 --- Sequence "contacts_seq"  
116 --- Name: contacts_seq; Type: SEQUENCE; Schema: public; Owner: postgres  
117 ---  
118 -  
119 -CREATE SEQUENCE contacts_seq  
120 - START WITH 1  
121 - INCREMENT BY 1  
122 - NO MAXVALUE  
123 - NO MINVALUE  
124 - CACHE 1;  
125 -  
126 ---  
127 --- Table "contacts"  
128 --- Name: contacts; Type: TABLE; Schema: public; Owner: postgres  
129 ---  
130 -  
131 -CREATE TABLE contacts (  
132 - contact_id integer DEFAULT nextval('contacts_seq'::text) PRIMARY KEY,  
133 - user_id integer NOT NULL  
134 - REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,  
135 - changed timestamp with time zone DEFAULT now() NOT NULL,  
136 - del smallint DEFAULT 0 NOT NULL,  
137 - name varchar(128) DEFAULT '' NOT NULL,  
138 - email text DEFAULT '' NOT NULL,  
139 - firstname varchar(128) DEFAULT '' NOT NULL,  
140 - surname varchar(128) DEFAULT '' NOT NULL,  
141 - vcard text,  
142 - words text  
143 -);  
144 -  
145 -CREATE INDEX contacts_user_id_idx ON contacts (user_id, del);  
146 -  
147 ---  
148 --- Sequence "contactgroups_seq"  
149 --- Name: contactgroups_seq; Type: SEQUENCE; Schema: public; Owner: postgres  
150 ---  
151 -  
152 -CREATE SEQUENCE contactgroups_seq  
153 - INCREMENT BY 1  
154 - NO MAXVALUE  
155 - NO MINVALUE  
156 - CACHE 1;  
157 -  
158 ---  
159 --- Table "contactgroups"  
160 --- Name: contactgroups; Type: TABLE; Schema: public; Owner: postgres  
161 ---  
162 -  
163 -CREATE TABLE contactgroups (  
164 - contactgroup_id integer DEFAULT nextval('contactgroups_seq'::text) PRIMARY KEY,  
165 - user_id integer NOT NULL  
166 - REFERENCES users(user_id) ON DELETE CASCADE ON UPDATE CASCADE,  
167 - changed timestamp with time zone DEFAULT now() NOT NULL,  
168 - del smallint NOT NULL DEFAULT 0,  
169 - name varchar(128) NOT NULL DEFAULT ''  
170 -);  
171 -  
172 -CREATE INDEX contactgroups_user_id_idx ON contactgroups (user_id, del);  
173 -  
174 ---  
175 --- Table "contactgroupmembers"  
176 --- Name: contactgroupmembers; Type: TABLE; Schema: public; Owner: postgres  
177 ---  
178 -  
179 -CREATE TABLE contactgroupmembers (  
180 - contactgroup_id integer NOT NULL  
181 - REFERENCES contactgroups(contactgroup_id) ON DELETE CASCADE ON UPDATE CASCADE,  
182 - contact_id integer NOT NULL  
183 - REFERENCES contacts(contact_id) ON DELETE CASCADE ON UPDATE CASCADE,  
184 - created timestamp with time zone DEFAULT now() NOT NULL,  
185 - PRIMARY KEY (contactgroup_id, contact_id)  
186 -);  
187 -  
188 -CREATE INDEX contactgroupmembers_contact_id_idx ON contactgroupmembers (contact_id);  
189 -  
190 ---  
191 --- Table "cache"  
192 --- Name: cache; Type: TABLE; Schema: public; Owner: postgres  
193 ---  
194 -  
195 -CREATE TABLE "cache" (  
196 - user_id integer NOT NULL  
197 - REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,  
198 - cache_key varchar(128) DEFAULT '' NOT NULL,  
199 - expires timestamp with time zone DEFAULT NULL,  
200 - data text NOT NULL,  
201 - PRIMARY KEY (user_id, cache_key)  
202 -);  
203 -  
204 -CREATE INDEX cache_expires_idx ON "cache" (expires);  
205 -  
206 ---  
207 --- Table "cache_shared"  
208 --- Name: cache_shared; Type: TABLE; Schema: public; Owner: postgres  
209 ---  
210 -  
211 -CREATE TABLE "cache_shared" (  
212 - cache_key varchar(255) NOT NULL PRIMARY KEY,  
213 - expires timestamp with time zone DEFAULT NULL,  
214 - data text NOT NULL  
215 -);  
216 -  
217 -CREATE INDEX cache_shared_expires_idx ON "cache_shared" (expires);  
218 -  
219 ---  
220 --- Table "cache_index"  
221 --- Name: cache_index; Type: TABLE; Schema: public; Owner: postgres  
222 ---  
223 -  
224 -CREATE TABLE cache_index (  
225 - user_id integer NOT NULL  
226 - REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,  
227 - mailbox varchar(255) NOT NULL,  
228 - expires timestamp with time zone DEFAULT NULL,  
229 - valid smallint NOT NULL DEFAULT 0,  
230 - data text NOT NULL,  
231 - PRIMARY KEY (user_id, mailbox)  
232 -);  
233 -  
234 -CREATE INDEX cache_index_expires_idx ON cache_index (expires);  
235 -  
236 ---  
237 --- Table "cache_thread"  
238 --- Name: cache_thread; Type: TABLE; Schema: public; Owner: postgres  
239 ---  
240 -  
241 -CREATE TABLE cache_thread (  
242 - user_id integer NOT NULL  
243 - REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,  
244 - mailbox varchar(255) NOT NULL,  
245 - expires timestamp with time zone DEFAULT NULL,  
246 - data text NOT NULL,  
247 - PRIMARY KEY (user_id, mailbox)  
248 -);  
249 -  
250 -CREATE INDEX cache_thread_expires_idx ON cache_thread (expires);  
251 -  
252 ---  
253 --- Table "cache_messages"  
254 --- Name: cache_messages; Type: TABLE; Schema: public; Owner: postgres  
255 ---  
256 -  
257 -CREATE TABLE cache_messages (  
258 - user_id integer NOT NULL  
259 - REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,  
260 - mailbox varchar(255) NOT NULL,  
261 - uid integer NOT NULL,  
262 - expires timestamp with time zone DEFAULT NULL,  
263 - data text NOT NULL,  
264 - flags integer NOT NULL DEFAULT 0,  
265 - PRIMARY KEY (user_id, mailbox, uid)  
266 -);  
267 -  
268 -CREATE INDEX cache_messages_expires_idx ON cache_messages (expires);  
269 -  
270 ---  
271 --- Table "dictionary"  
272 --- Name: dictionary; Type: TABLE; Schema: public; Owner: postgres  
273 ---  
274 -  
275 -CREATE TABLE dictionary (  
276 - user_id integer DEFAULT NULL  
277 - REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,  
278 - "language" varchar(16) NOT NULL,  
279 - data text NOT NULL,  
280 - CONSTRAINT dictionary_user_id_language_key UNIQUE (user_id, "language")  
281 -);  
282 -  
283 ---  
284 --- Sequence "searches_seq"  
285 --- Name: searches_seq; Type: SEQUENCE; Schema: public; Owner: postgres  
286 ---  
287 -  
288 -CREATE SEQUENCE searches_seq  
289 - INCREMENT BY 1  
290 - NO MAXVALUE  
291 - NO MINVALUE  
292 - CACHE 1;  
293 -  
294 ---  
295 --- Table "searches"  
296 --- Name: searches; Type: TABLE; Schema: public; Owner: postgres  
297 ---  
298 -  
299 -CREATE TABLE searches (  
300 - search_id integer DEFAULT nextval('searches_seq'::text) PRIMARY KEY,  
301 - user_id integer NOT NULL  
302 - REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,  
303 - "type" smallint DEFAULT 0 NOT NULL,  
304 - name varchar(128) NOT NULL,  
305 - data text NOT NULL,  
306 - CONSTRAINT searches_user_id_key UNIQUE (user_id, "type", name)  
307 -);  
308 -  
309 ---  
310 --- Sequence "filestore_seq"  
311 --- Name: filestore_seq; Type: SEQUENCE; Schema: public; Owner: postgres  
312 ---  
313 -  
314 -CREATE SEQUENCE "filestore_seq"  
315 - INCREMENT BY 1  
316 - NO MAXVALUE  
317 - NO MINVALUE  
318 - CACHE 1;  
319 -  
320 ---  
321 --- Table "filestore"  
322 --- Name: filestore; Type: TABLE; Schema: public; Owner: postgres  
323 ---  
324 -  
325 -CREATE TABLE "filestore" (  
326 - file_id integer DEFAULT nextval('filestore_seq'::text) PRIMARY KEY,  
327 - user_id integer NOT NULL  
328 - REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,  
329 - context varchar(32) NOT NULL,  
330 - filename varchar(128) NOT NULL,  
331 - mtime integer NOT NULL,  
332 - data text NOT NULL,  
333 - CONSTRAINT filestore_user_id_filename UNIQUE (user_id, context, filename)  
334 -);  
335 -  
336 ---  
337 --- Table "system"  
338 --- Name: system; Type: TABLE; Schema: public; Owner: postgres  
339 ---  
340 -  
341 -CREATE TABLE "system" (  
342 - name varchar(64) NOT NULL PRIMARY KEY,  
343 - value text  
344 -);  
345 -  
346 -INSERT INTO "system" (name, value) VALUES ('roundcube-version', '2020122900');  
1 --- Updates from version 0.1-stable to 0.1.1  
2 -  
3 -CREATE INDEX cache_user_id_idx ON cache (user_id, cache_key);  
4 -CREATE INDEX contacts_user_id_idx ON contacts (user_id);  
5 -CREATE INDEX identities_user_id_idx ON identities (user_id);  
6 -  
7 -CREATE INDEX users_username_id_idx ON users (username);  
8 -CREATE INDEX users_alias_id_idx ON users (alias);  
9 -  
10 --- added ON DELETE/UPDATE actions  
11 -ALTER TABLE messages DROP CONSTRAINT messages_user_id_fkey;  
12 -ALTER TABLE messages ADD FOREIGN KEY (user_id) REFERENCES users(user_id) ON DELETE CASCADE ON UPDATE CASCADE;  
13 -ALTER TABLE identities DROP CONSTRAINT identities_user_id_fkey;  
14 -ALTER TABLE identities ADD FOREIGN KEY (user_id) REFERENCES users(user_id) ON DELETE CASCADE ON UPDATE CASCADE;  
15 -ALTER TABLE contacts DROP CONSTRAINT contacts_user_id_fkey;  
16 -ALTER TABLE contacts ADD FOREIGN KEY (user_id) REFERENCES users(user_id) ON DELETE CASCADE ON UPDATE CASCADE;  
17 -ALTER TABLE cache DROP CONSTRAINT cache_user_id_fkey;  
1 --- Updates from version 0.2-alpha  
2 -  
3 -CREATE INDEX messages_created_idx ON messages (created);  
1 --- Updates from version 0.2-beta  
2 -  
3 -ALTER TABLE cache DROP session_id;  
4 -  
5 -CREATE INDEX session_changed_idx ON session (changed);  
6 -CREATE INDEX cache_created_idx ON "cache" (created);  
7 -  
8 -ALTER TABLE users ALTER "language" DROP NOT NULL;  
9 -ALTER TABLE users ALTER "language" DROP DEFAULT;  
10 -  
11 -ALTER TABLE identities ALTER del TYPE smallint;  
12 -ALTER TABLE identities ALTER standard TYPE smallint;  
13 -ALTER TABLE contacts ALTER del TYPE smallint;  
14 -ALTER TABLE messages ALTER del TYPE smallint;  
1 --- Updates from version 0.3-stable  
2 -  
3 -TRUNCATE messages;  
4 -CREATE INDEX messages_index_idx ON messages (user_id, cache_key, idx);  
5 -DROP INDEX contacts_user_id_idx;  
6 -CREATE INDEX contacts_user_id_idx ON contacts (user_id, email);  
1 --- Updates from version 0.3.1  
2 -  
3 -DROP INDEX identities_user_id_idx;  
4 -CREATE INDEX identities_user_id_idx ON identities (user_id, del);  
5 -  
6 -ALTER TABLE identities ADD changed timestamp with time zone DEFAULT now() NOT NULL;  
7 -  
8 -CREATE SEQUENCE contactgroups_ids  
9 - INCREMENT BY 1  
10 - NO MAXVALUE  
11 - NO MINVALUE  
12 - CACHE 1;  
13 -  
14 -CREATE TABLE contactgroups (  
15 - contactgroup_id integer DEFAULT nextval('contactgroups_ids'::text) PRIMARY KEY,  
16 - user_id integer NOT NULL  
17 - REFERENCES users(user_id) ON DELETE CASCADE ON UPDATE CASCADE,  
18 - changed timestamp with time zone DEFAULT now() NOT NULL,  
19 - del smallint NOT NULL DEFAULT 0,  
20 - name varchar(128) NOT NULL DEFAULT ''  
21 -);  
22 -  
23 -CREATE INDEX contactgroups_user_id_idx ON contactgroups (user_id, del);  
24 -  
25 -CREATE TABLE contactgroupmembers (  
26 - contactgroup_id integer NOT NULL  
27 - REFERENCES contactgroups(contactgroup_id) ON DELETE CASCADE ON UPDATE CASCADE,  
28 - contact_id integer NOT NULL  
29 - REFERENCES contacts(contact_id) ON DELETE CASCADE ON UPDATE CASCADE,  
30 - created timestamp with time zone DEFAULT now() NOT NULL,  
31 - PRIMARY KEY (contactgroup_id, contact_id)  
32 -);  
1 --- Updates from version 0.4-beta  
2 -  
3 -ALTER TABLE users ALTER last_login DROP NOT NULL;  
4 -ALTER TABLE users ALTER last_login SET DEFAULT NULL;  
1 --- Updates from version 0.4.2  
2 -  
3 -DROP INDEX users_username_id_idx;  
4 -ALTER TABLE users ADD CONSTRAINT users_username_key UNIQUE (username, mail_host);  
5 -ALTER TABLE contacts ALTER email TYPE varchar(255);  
6 -  
7 -TRUNCATE messages;  
1 --- Updates from version 0.5.x  
2 -  
3 -ALTER TABLE contacts ADD words TEXT NULL;  
4 -CREATE INDEX contactgroupmembers_contact_id_idx ON contactgroupmembers (contact_id);  
5 -  
6 -TRUNCATE messages;  
7 -TRUNCATE cache;  
1 --- Updates from version 0.6  
2 -  
3 -CREATE TABLE dictionary (  
4 - user_id integer DEFAULT NULL  
5 - REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,  
6 - "language" varchar(5) NOT NULL,  
7 - data text NOT NULL,  
8 - CONSTRAINT dictionary_user_id_language_key UNIQUE (user_id, "language")  
9 -);  
10 -  
11 -CREATE SEQUENCE search_ids  
12 - INCREMENT BY 1  
13 - NO MAXVALUE  
14 - NO MINVALUE  
15 - CACHE 1;  
16 -  
17 -CREATE TABLE searches (  
18 - search_id integer DEFAULT nextval('search_ids'::text) PRIMARY KEY,  
19 - user_id integer NOT NULL  
20 - REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,  
21 - "type" smallint DEFAULT 0 NOT NULL,  
22 - name varchar(128) NOT NULL,  
23 - data text NOT NULL,  
24 - CONSTRAINT searches_user_id_key UNIQUE (user_id, "type", name)  
25 -);  
26 -  
27 -DROP SEQUENCE message_ids;  
28 -DROP TABLE messages;  
29 -  
30 -CREATE TABLE cache_index (  
31 - user_id integer NOT NULL  
32 - REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,  
33 - mailbox varchar(255) NOT NULL,  
34 - changed timestamp with time zone DEFAULT now() NOT NULL,  
35 - valid smallint NOT NULL DEFAULT 0,  
36 - data text NOT NULL,  
37 - PRIMARY KEY (user_id, mailbox)  
38 -);  
39 -  
40 -CREATE INDEX cache_index_changed_idx ON cache_index (changed);  
41 -  
42 -CREATE TABLE cache_thread (  
43 - user_id integer NOT NULL  
44 - REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,  
45 - mailbox varchar(255) NOT NULL,  
46 - changed timestamp with time zone DEFAULT now() NOT NULL,  
47 - data text NOT NULL,  
48 - PRIMARY KEY (user_id, mailbox)  
49 -);  
50 -  
51 -CREATE INDEX cache_thread_changed_idx ON cache_thread (changed);  
52 -  
53 -CREATE TABLE cache_messages (  
54 - user_id integer NOT NULL  
55 - REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,  
56 - mailbox varchar(255) NOT NULL,  
57 - uid integer NOT NULL,  
58 - changed timestamp with time zone DEFAULT now() NOT NULL,  
59 - data text NOT NULL,  
60 - flags integer NOT NULL DEFAULT 0,  
61 - PRIMARY KEY (user_id, mailbox, uid)  
62 -);  
63 -  
64 -CREATE INDEX cache_messages_changed_idx ON cache_messages (changed);  
1 --- Updates from version 0.7-beta  
2 -  
3 -ALTER TABLE "session" ALTER sess_id TYPE varchar(128);  
1 --- Updates from version 0.7  
2 -  
3 -DROP INDEX contacts_user_id_idx;  
4 -CREATE INDEX contacts_user_id_idx ON contacts USING btree (user_id, del);  
5 -ALTER TABLE contacts ALTER email TYPE text;  
1 --- Updates from version 0.8  
2 -  
3 -ALTER TABLE cache DROP COLUMN cache_id;  
4 -DROP SEQUENCE cache_ids;  
5 -  
6 -ALTER TABLE users DROP COLUMN alias;  
7 -CREATE INDEX identities_email_idx ON identities (email, del);  
1 -CREATE TABLE "system" (  
2 - name varchar(64) NOT NULL PRIMARY KEY,  
3 - value text  
4 -);  
1 -ALTER SEQUENCE user_ids RENAME TO users_seq;  
2 -ALTER TABLE users ALTER COLUMN user_id SET DEFAULT nextval('users_seq'::text);  
3 -  
4 -ALTER SEQUENCE identity_ids RENAME TO identities_seq;  
5 -ALTER TABLE identities ALTER COLUMN identity_id SET DEFAULT nextval('identities_seq'::text);  
6 -  
7 -ALTER SEQUENCE contact_ids RENAME TO contacts_seq;  
8 -ALTER TABLE contacts ALTER COLUMN contact_id SET DEFAULT nextval('contacts_seq'::text);  
9 -  
10 -ALTER SEQUENCE contactgroups_ids RENAME TO contactgroups_seq;  
11 -ALTER TABLE contactgroups ALTER COLUMN contactgroup_id SET DEFAULT nextval('contactgroups_seq'::text);  
12 -  
13 -ALTER SEQUENCE search_ids RENAME TO searches_seq;  
14 -ALTER TABLE searches ALTER COLUMN search_id SET DEFAULT nextval('searches_seq'::text);  
1 -CREATE TABLE "cache_shared" (  
2 - cache_key varchar(255) NOT NULL,  
3 - created timestamp with time zone DEFAULT now() NOT NULL,  
4 - data text NOT NULL  
5 -);  
6 -  
7 -CREATE INDEX cache_shared_cache_key_idx ON "cache_shared" (cache_key);  
8 -CREATE INDEX cache_shared_created_idx ON "cache_shared" (created);  
1 -ALTER TABLE "cache" ADD expires timestamp with time zone DEFAULT NULL;  
2 -ALTER TABLE "cache_shared" ADD expires timestamp with time zone DEFAULT NULL;  
3 -ALTER TABLE "cache_index" ADD expires timestamp with time zone DEFAULT NULL;  
4 -ALTER TABLE "cache_thread" ADD expires timestamp with time zone DEFAULT NULL;  
5 -ALTER TABLE "cache_messages" ADD expires timestamp with time zone DEFAULT NULL;  
6 -  
7 --- initialize expires column with created/changed date + 7days  
8 -UPDATE "cache" SET expires = created + interval '604800 seconds';  
9 -UPDATE "cache_shared" SET expires = created + interval '604800 seconds';  
10 -UPDATE "cache_index" SET expires = changed + interval '604800 seconds';  
11 -UPDATE "cache_thread" SET expires = changed + interval '604800 seconds';  
12 -UPDATE "cache_messages" SET expires = changed + interval '604800 seconds';  
13 -  
14 -DROP INDEX cache_created_idx;  
15 -DROP INDEX cache_shared_created_idx;  
16 -ALTER TABLE "cache_index" DROP "changed";  
17 -ALTER TABLE "cache_thread" DROP "changed";  
18 -ALTER TABLE "cache_messages" DROP "changed";  
19 -  
20 -CREATE INDEX cache_expires_idx ON "cache" (expires);  
21 -CREATE INDEX cache_shared_expires_idx ON "cache_shared" (expires);  
22 -CREATE INDEX cache_index_expires_idx ON "cache_index" (expires);  
23 -CREATE INDEX cache_thread_expires_idx ON "cache_thread" (expires);  
24 -CREATE INDEX cache_messages_expires_idx ON "cache_messages" (expires);  
1 -ALTER TABLE "users" ADD failed_login timestamp with time zone DEFAULT NULL;  
2 -ALTER TABLE "users" ADD failed_login_counter integer DEFAULT NULL;  
1 -ALTER TABLE "session" DROP COLUMN created;  
1 -ALTER TABLE session ALTER COLUMN ip TYPE character varying(41);  
1 -DROP TABLE "cache";  
2 -DROP TABLE "cache_shared";  
3 -  
4 -CREATE TABLE "cache" (  
5 - user_id integer NOT NULL  
6 - REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,  
7 - cache_key varchar(128) DEFAULT '' NOT NULL,  
8 - expires timestamp with time zone DEFAULT NULL,  
9 - data text NOT NULL,  
10 - PRIMARY KEY (user_id, cache_key)  
11 -);  
12 -  
13 -CREATE INDEX cache_expires_idx ON "cache" (expires);  
14 -  
15 -CREATE TABLE "cache_shared" (  
16 - cache_key varchar(255) NOT NULL PRIMARY KEY,  
17 - expires timestamp with time zone DEFAULT NULL,  
18 - data text NOT NULL  
19 -);  
20 -  
21 -CREATE INDEX cache_shared_expires_idx ON "cache_shared" (expires);  
1 -CREATE SEQUENCE "filestore_seq"  
2 - INCREMENT BY 1  
3 - NO MAXVALUE  
4 - NO MINVALUE  
5 - CACHE 1;  
6 -  
7 -CREATE TABLE "filestore" (  
8 - file_id integer DEFAULT nextval('filestore_seq'::text) PRIMARY KEY,  
9 - user_id integer NOT NULL  
10 - REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,  
11 - filename varchar(128) NOT NULL,  
12 - mtime integer NOT NULL,  
13 - data text NOT NULL,  
14 - CONSTRAINT filestore_user_id_filename UNIQUE (user_id, filename)  
15 -);  
1 -ALTER TABLE "filestore" ADD COLUMN context varchar(32) NOT NULL;  
2 -UPDATE "filestore" SET context = 'enigma';  
3 -ALTER TABLE "filestore" DROP CONSTRAINT "filestore_user_id_filename";  
4 -ALTER TABLE "filestore" ADD CONSTRAINT "filestore_user_id_context_filename" UNIQUE (user_id, context, filename);  
1 -ALTER TABLE "dictionary" ALTER COLUMN "language" TYPE varchar(16);  
2 -ALTER TABLE "users" ALTER COLUMN "language" TYPE varchar(16);  
1 -CREATE SEQUENCE collected_addresses_seq  
2 - START WITH 1  
3 - INCREMENT BY 1  
4 - NO MAXVALUE  
5 - NO MINVALUE  
6 - CACHE 1;  
7 -  
8 -CREATE TABLE collected_addresses (  
9 - address_id integer DEFAULT nextval('collected_addresses_seq'::text) PRIMARY KEY,  
10 - user_id integer NOT NULL  
11 - REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,  
12 - changed timestamp with time zone DEFAULT now() NOT NULL,  
13 - name varchar(255) DEFAULT '' NOT NULL,  
14 - email varchar(255) NOT NULL,  
15 - "type" integer NOT NULL  
16 -);  
17 -  
18 -CREATE UNIQUE INDEX collected_addresses_user_id_idx ON collected_addresses (user_id, "type", email);  
1 -ALTER TABLE "users" ALTER COLUMN "preferences" DROP NOT NULL;  
2 -ALTER TABLE "users" ALTER COLUMN "preferences" SET DEFAULT NULL;  
1 --- Roundcube Webmail initial database structure  
2 -  
3 ---  
4 --- Table structure for table contacts and related  
5 ---  
6 -  
7 -CREATE TABLE contacts (  
8 - contact_id integer NOT NULL PRIMARY KEY,  
9 - user_id integer NOT NULL,  
10 - changed datetime NOT NULL default '0000-00-00 00:00:00',  
11 - del tinyint NOT NULL default '0',  
12 - name varchar(128) NOT NULL default '',  
13 - email text NOT NULL default '',  
14 - firstname varchar(128) NOT NULL default '',  
15 - surname varchar(128) NOT NULL default '',  
16 - vcard text NOT NULL default '',  
17 - words text NOT NULL default ''  
18 -);  
19 -  
20 -CREATE INDEX ix_contacts_user_id ON contacts(user_id, del);  
21 -  
22 -  
23 -CREATE TABLE contactgroups (  
24 - contactgroup_id integer NOT NULL PRIMARY KEY,  
25 - user_id integer NOT NULL default '0',  
26 - changed datetime NOT NULL default '0000-00-00 00:00:00',  
27 - del tinyint NOT NULL default '0',  
28 - name varchar(128) NOT NULL default ''  
29 -);  
30 -  
31 -CREATE INDEX ix_contactgroups_user_id ON contactgroups(user_id, del);  
32 -  
33 -  
34 -CREATE TABLE contactgroupmembers (  
35 - contactgroup_id integer NOT NULL,  
36 - contact_id integer NOT NULL default '0',  
37 - created datetime NOT NULL default '0000-00-00 00:00:00',  
38 - PRIMARY KEY (contactgroup_id, contact_id)  
39 -);  
40 -  
41 -CREATE INDEX ix_contactgroupmembers_contact_id ON contactgroupmembers (contact_id);  
42 -  
43 ---  
44 --- Table structure for table collected_addresses  
45 ---  
46 -  
47 -CREATE TABLE collected_addresses (  
48 - address_id integer NOT NULL PRIMARY KEY,  
49 - user_id integer NOT NULL,  
50 - changed datetime NOT NULL default '0000-00-00 00:00:00',  
51 - name varchar(255) NOT NULL default '',  
52 - email varchar(255) NOT NULL,  
53 - "type" integer NOT NULL  
54 -);  
55 -  
56 -CREATE UNIQUE INDEX ix_collected_addresses_user_id ON collected_addresses(user_id, "type", email);  
57 -  
58 ---  
59 --- Table structure for table identities  
60 ---  
61 -  
62 -CREATE TABLE identities (  
63 - identity_id integer NOT NULL PRIMARY KEY,  
64 - user_id integer NOT NULL default '0',  
65 - changed datetime NOT NULL default '0000-00-00 00:00:00',  
66 - del tinyint NOT NULL default '0',  
67 - standard tinyint NOT NULL default '0',  
68 - name varchar(128) NOT NULL default '',  
69 - organization varchar(128) default '',  
70 - email varchar(128) NOT NULL default '',  
71 - "reply-to" varchar(128) NOT NULL default '',  
72 - bcc varchar(128) NOT NULL default '',  
73 - signature text NOT NULL default '',  
74 - html_signature tinyint NOT NULL default '0'  
75 -);  
76 -  
77 -CREATE INDEX ix_identities_user_id ON identities(user_id, del);  
78 -CREATE INDEX ix_identities_email ON identities(email, del);  
79 -  
80 ---  
81 --- Table structure for table users  
82 ---  
83 -  
84 -CREATE TABLE users (  
85 - user_id integer NOT NULL PRIMARY KEY,  
86 - username varchar(128) NOT NULL default '',  
87 - mail_host varchar(128) NOT NULL default '',  
88 - created datetime NOT NULL default '0000-00-00 00:00:00',  
89 - last_login datetime DEFAULT NULL,  
90 - failed_login datetime DEFAULT NULL,  
91 - failed_login_counter integer DEFAULT NULL,  
92 - language varchar(16),  
93 - preferences text DEFAULT NULL  
94 -);  
95 -  
96 -CREATE UNIQUE INDEX ix_users_username ON users(username, mail_host);  
97 -  
98 ---  
99 --- Table structure for table session  
100 ---  
101 -  
102 -CREATE TABLE session (  
103 - sess_id varchar(128) NOT NULL PRIMARY KEY,  
104 - changed datetime NOT NULL default '0000-00-00 00:00:00',  
105 - ip varchar(40) NOT NULL default '',  
106 - vars text NOT NULL  
107 -);  
108 -  
109 -CREATE INDEX ix_session_changed ON session (changed);  
110 -  
111 ---  
112 --- Table structure for table dictionary  
113 ---  
114 -  
115 -CREATE TABLE dictionary (  
116 - user_id integer DEFAULT NULL,  
117 - language varchar(16) NOT NULL,  
118 - data text NOT NULL  
119 -);  
120 -  
121 -CREATE UNIQUE INDEX ix_dictionary_user_language ON dictionary (user_id, language);  
122 -  
123 ---  
124 --- Table structure for table searches  
125 ---  
126 -  
127 -CREATE TABLE searches (  
128 - search_id integer NOT NULL PRIMARY KEY,  
129 - user_id integer NOT NULL DEFAULT '0',  
130 - "type" smallint NOT NULL DEFAULT '0',  
131 - name varchar(128) NOT NULL,  
132 - data text NOT NULL  
133 -);  
134 -  
135 -CREATE UNIQUE INDEX ix_searches_user_type_name ON searches (user_id, type, name);  
136 -  
137 ---  
138 --- Table structure for table cache  
139 ---  
140 -  
141 -CREATE TABLE cache (  
142 - user_id integer NOT NULL default 0,  
143 - cache_key varchar(128) NOT NULL default '',  
144 - expires datetime DEFAULT NULL,  
145 - data text NOT NULL,  
146 - PRIMARY KEY (user_id, cache_key)  
147 -);  
148 -  
149 -CREATE INDEX ix_cache_expires ON cache(expires);  
150 -  
151 ---  
152 --- Table structure for table cache_shared  
153 ---  
154 -  
155 -CREATE TABLE cache_shared (  
156 - cache_key varchar(255) NOT NULL,  
157 - expires datetime DEFAULT NULL,  
158 - data text NOT NULL,  
159 - PRIMARY KEY (cache_key)  
160 -);  
161 -  
162 -CREATE INDEX ix_cache_shared_expires ON cache_shared(expires);  
163 -  
164 ---  
165 --- Table structure for table cache_index  
166 ---  
167 -  
168 -CREATE TABLE cache_index (  
169 - user_id integer NOT NULL,  
170 - mailbox varchar(255) NOT NULL,  
171 - expires datetime DEFAULT NULL,  
172 - valid smallint NOT NULL DEFAULT '0',  
173 - data text NOT NULL,  
174 - PRIMARY KEY (user_id, mailbox)  
175 -);  
176 -  
177 -CREATE INDEX ix_cache_index_expires ON cache_index (expires);  
178 -  
179 ---  
180 --- Table structure for table cache_thread  
181 ---  
182 -  
183 -CREATE TABLE cache_thread (  
184 - user_id integer NOT NULL,  
185 - mailbox varchar(255) NOT NULL,  
186 - expires datetime DEFAULT NULL,  
187 - data text NOT NULL,  
188 - PRIMARY KEY (user_id, mailbox)  
189 -);  
190 -  
191 -CREATE INDEX ix_cache_thread_expires ON cache_thread (expires);  
192 -  
193 ---  
194 --- Table structure for table cache_messages  
195 ---  
196 -  
197 -CREATE TABLE cache_messages (  
198 - user_id integer NOT NULL,  
199 - mailbox varchar(255) NOT NULL,  
200 - uid integer NOT NULL,  
201 - expires datetime DEFAULT NULL,  
202 - data text NOT NULL,  
203 - flags integer NOT NULL DEFAULT '0',  
204 - PRIMARY KEY (user_id, mailbox, uid)  
205 -);  
206 -  
207 -CREATE INDEX ix_cache_messages_expires ON cache_messages (expires);  
208 -  
209 ---  
210 --- Table structure for table filestore  
211 ---  
212 -  
213 -CREATE TABLE filestore (  
214 - file_id integer NOT NULL PRIMARY KEY,  
215 - user_id integer NOT NULL,  
216 - context varchar(32) NOT NULL,  
217 - filename varchar(128) NOT NULL,  
218 - mtime integer NOT NULL,  
219 - data text NOT NULL  
220 -);  
221 -  
222 -CREATE UNIQUE INDEX ix_filestore_user_id ON filestore(user_id, context, filename);  
223 -  
224 ---  
225 --- Table structure for table system  
226 ---  
227 -  
228 -CREATE TABLE system (  
229 - name varchar(64) NOT NULL PRIMARY KEY,  
230 - value text NOT NULL  
231 -);  
232 -  
233 -INSERT INTO system (name, value) VALUES ('roundcube-version', '2020122900');  
1 --- Updates from version 0.1-stable to 0.1.1  
2 -  
3 -DROP TABLE messages;  
4 -  
5 -CREATE TABLE messages (  
6 - message_id integer NOT NULL PRIMARY KEY,  
7 - user_id integer NOT NULL default '0',  
8 - del tinyint NOT NULL default '0',  
9 - cache_key varchar(128) NOT NULL default '',  
10 - created datetime NOT NULL default '0000-00-00 00:00:00',  
11 - idx integer NOT NULL default '0',  
12 - uid integer NOT NULL default '0',  
13 - subject varchar(255) NOT NULL default '',  
14 - "from" varchar(255) NOT NULL default '',  
15 - "to" varchar(255) NOT NULL default '',  
16 - "cc" varchar(255) NOT NULL default '',  
17 - "date" datetime NOT NULL default '0000-00-00 00:00:00',  
18 - size integer NOT NULL default '0',  
19 - headers text NOT NULL,  
20 - structure text  
21 -);  
22 -  
23 -CREATE INDEX ix_messages_user_cache_uid ON messages(user_id,cache_key,uid);  
24 -CREATE INDEX ix_users_username ON users(username);  
25 -CREATE INDEX ix_users_alias ON users(alias);  
1 --- Updates from version 0.2-alpha  
2 -  
3 -CREATE INDEX ix_messages_created ON messages (created);  
1 --- Updates from version 0.2-beta  
2 -  
3 -CREATE INDEX ix_session_changed ON session (changed);  
4 -CREATE INDEX ix_cache_created ON cache (created);  
1 --- Updates from version 0.3-stable  
2 -  
3 -DELETE FROM messages;  
4 -DROP INDEX ix_messages_user_cache_uid;  
5 -CREATE UNIQUE INDEX ix_messages_user_cache_uid ON messages (user_id,cache_key,uid);  
6 -CREATE INDEX ix_messages_index ON messages (user_id,cache_key,idx);  
7 -DROP INDEX ix_contacts_user_id;  
8 -CREATE INDEX ix_contacts_user_id ON contacts(user_id, email);  
1 --- Updates from version 0.3.1  
2 -  
3 --- ALTER TABLE identities ADD COLUMN changed datetime NOT NULL default '0000-00-00 00:00:00'; --  
4 -  
5 -CREATE TABLE temp_identities (  
6 - identity_id integer NOT NULL PRIMARY KEY,  
7 - user_id integer NOT NULL default '0',  
8 - standard tinyint NOT NULL default '0',  
9 - name varchar(128) NOT NULL default '',  
10 - organization varchar(128) default '',  
11 - email varchar(128) NOT NULL default '',  
12 - "reply-to" varchar(128) NOT NULL default '',  
13 - bcc varchar(128) NOT NULL default '',  
14 - signature text NOT NULL default '',  
15 - html_signature tinyint NOT NULL default '0'  
16 -);  
17 -INSERT INTO temp_identities (identity_id, user_id, standard, name, organization, email, "reply-to", bcc, signature, html_signature)  
18 - SELECT identity_id, user_id, standard, name, organization, email, "reply-to", bcc, signature, html_signature  
19 - FROM identities WHERE del=0;  
20 -  
21 -DROP INDEX ix_identities_user_id;  
22 -DROP TABLE identities;  
23 -  
24 -CREATE TABLE identities (  
25 - identity_id integer NOT NULL PRIMARY KEY,  
26 - user_id integer NOT NULL default '0',  
27 - changed datetime NOT NULL default '0000-00-00 00:00:00',  
28 - del tinyint NOT NULL default '0',  
29 - standard tinyint NOT NULL default '0',  
30 - name varchar(128) NOT NULL default '',  
31 - organization varchar(128) default '',  
32 - email varchar(128) NOT NULL default '',  
33 - "reply-to" varchar(128) NOT NULL default '',  
34 - bcc varchar(128) NOT NULL default '',  
35 - signature text NOT NULL default '',  
36 - html_signature tinyint NOT NULL default '0'  
37 -);  
38 -CREATE INDEX ix_identities_user_id ON identities(user_id, del);  
39 -  
40 -INSERT INTO identities (identity_id, user_id, standard, name, organization, email, "reply-to", bcc, signature, html_signature)  
41 - SELECT identity_id, user_id, standard, name, organization, email, "reply-to", bcc, signature, html_signature  
42 - FROM temp_identities;  
43 -  
44 -DROP TABLE temp_identities;  
45 -  
46 -CREATE TABLE contactgroups (  
47 - contactgroup_id integer NOT NULL PRIMARY KEY,  
48 - user_id integer NOT NULL default '0',  
49 - changed datetime NOT NULL default '0000-00-00 00:00:00',  
50 - del tinyint NOT NULL default '0',  
51 - name varchar(128) NOT NULL default ''  
52 -);  
53 -  
54 -CREATE INDEX ix_contactgroups_user_id ON contactgroups(user_id, del);  
55 -  
56 -CREATE TABLE contactgroupmembers (  
57 - contactgroup_id integer NOT NULL,  
58 - contact_id integer NOT NULL default '0',  
59 - created datetime NOT NULL default '0000-00-00 00:00:00',  
60 - PRIMARY KEY (contactgroup_id, contact_id)  
61 -);  
1 --- Updates from version 0.4-beta  
2 -  
3 -CREATE TABLE tmp_users (  
4 - user_id integer NOT NULL PRIMARY KEY,  
5 - username varchar(128) NOT NULL default '',  
6 - mail_host varchar(128) NOT NULL default '',  
7 - alias varchar(128) NOT NULL default '',  
8 - created datetime NOT NULL default '0000-00-00 00:00:00',  
9 - last_login datetime NOT NULL default '0000-00-00 00:00:00',  
10 - language varchar(5),  
11 - preferences text NOT NULL default ''  
12 -);  
13 -  
14 -INSERT INTO tmp_users (user_id, username, mail_host, alias, created, last_login, language, preferences)  
15 - SELECT user_id, username, mail_host, alias, created, last_login, language, preferences FROM users;  
16 -  
17 -DROP TABLE users;  
18 -  
19 -CREATE TABLE users (  
20 - user_id integer NOT NULL PRIMARY KEY,  
21 - username varchar(128) NOT NULL default '',  
22 - mail_host varchar(128) NOT NULL default '',  
23 - alias varchar(128) NOT NULL default '',  
24 - created datetime NOT NULL default '0000-00-00 00:00:00',  
25 - last_login datetime DEFAULT NULL,  
26 - language varchar(5),  
27 - preferences text NOT NULL default ''  
28 -);  
29 -  
30 -INSERT INTO users (user_id, username, mail_host, alias, created, last_login, language, preferences)  
31 - SELECT user_id, username, mail_host, alias, created, last_login, language, preferences FROM tmp_users;  
32 -  
33 -CREATE INDEX ix_users_username ON users(username);  
34 -CREATE INDEX ix_users_alias ON users(alias);  
35 -DROP TABLE tmp_users;  
1 --- Updates from version 0.4.2  
2 -  
3 -DROP INDEX ix_users_username;  
4 -CREATE UNIQUE INDEX ix_users_username ON users(username, mail_host);  
5 -  
6 -CREATE TABLE contacts_tmp (  
7 - contact_id integer NOT NULL PRIMARY KEY,  
8 - user_id integer NOT NULL default '0',  
9 - changed datetime NOT NULL default '0000-00-00 00:00:00',  
10 - del tinyint NOT NULL default '0',  
11 - name varchar(128) NOT NULL default '',  
12 - email varchar(255) NOT NULL default '',  
13 - firstname varchar(128) NOT NULL default '',  
14 - surname varchar(128) NOT NULL default '',  
15 - vcard text NOT NULL default ''  
16 -);  
17 -  
18 -INSERT INTO contacts_tmp (contact_id, user_id, changed, del, name, email, firstname, surname, vcard)  
19 - SELECT contact_id, user_id, changed, del, name, email, firstname, surname, vcard FROM contacts;  
20 -  
21 -DROP TABLE contacts;  
22 -CREATE TABLE contacts (  
23 - contact_id integer NOT NULL PRIMARY KEY,  
24 - user_id integer NOT NULL default '0',  
25 - changed datetime NOT NULL default '0000-00-00 00:00:00',  
26 - del tinyint NOT NULL default '0',  
27 - name varchar(128) NOT NULL default '',  
28 - email varchar(255) NOT NULL default '',  
29 - firstname varchar(128) NOT NULL default '',  
30 - surname varchar(128) NOT NULL default '',  
31 - vcard text NOT NULL default ''  
32 -);  
33 -  
34 -INSERT INTO contacts (contact_id, user_id, changed, del, name, email, firstname, surname, vcard)  
35 - SELECT contact_id, user_id, changed, del, name, email, firstname, surname, vcard FROM contacts_tmp;  
36 -  
37 -CREATE INDEX ix_contacts_user_id ON contacts(user_id, email);  
38 -DROP TABLE contacts_tmp;  
39 -  
40 -DELETE FROM messages;  
1 --- Updates from version 0.5.x  
2 -  
3 -CREATE TABLE contacts_tmp (  
4 - contact_id integer NOT NULL PRIMARY KEY,  
5 - user_id integer NOT NULL default '0',  
6 - changed datetime NOT NULL default '0000-00-00 00:00:00',  
7 - del tinyint NOT NULL default '0',  
8 - name varchar(128) NOT NULL default '',  
9 - email varchar(255) NOT NULL default '',  
10 - firstname varchar(128) NOT NULL default '',  
11 - surname varchar(128) NOT NULL default '',  
12 - vcard text NOT NULL default ''  
13 -);  
14 -  
15 -INSERT INTO contacts_tmp (contact_id, user_id, changed, del, name, email, firstname, surname, vcard)  
16 - SELECT contact_id, user_id, changed, del, name, email, firstname, surname, vcard FROM contacts;  
17 -  
18 -DROP TABLE contacts;  
19 -CREATE TABLE contacts (  
20 - contact_id integer NOT NULL PRIMARY KEY,  
21 - user_id integer NOT NULL default '0',  
22 - changed datetime NOT NULL default '0000-00-00 00:00:00',  
23 - del tinyint NOT NULL default '0',  
24 - name varchar(128) NOT NULL default '',  
25 - email varchar(255) NOT NULL default '',  
26 - firstname varchar(128) NOT NULL default '',  
27 - surname varchar(128) NOT NULL default '',  
28 - vcard text NOT NULL default '',  
29 - words text NOT NULL default ''  
30 -);  
31 -  
32 -INSERT INTO contacts (contact_id, user_id, changed, del, name, email, firstname, surname, vcard)  
33 - SELECT contact_id, user_id, changed, del, name, email, firstname, surname, vcard FROM contacts_tmp;  
34 -  
35 -CREATE INDEX ix_contacts_user_id ON contacts(user_id, email);  
36 -DROP TABLE contacts_tmp;  
37 -  
38 -  
39 -DELETE FROM messages;  
40 -DELETE FROM cache;  
41 -CREATE INDEX ix_contactgroupmembers_contact_id ON contactgroupmembers (contact_id);  
1 --- Updates from version 0.6  
2 -  
3 -CREATE TABLE dictionary (  
4 - user_id integer DEFAULT NULL,  
5 - "language" varchar(5) NOT NULL,  
6 - data text NOT NULL  
7 -);  
8 -  
9 -CREATE UNIQUE INDEX ix_dictionary_user_language ON dictionary (user_id, "language");  
10 -  
11 -CREATE TABLE searches (  
12 - search_id integer NOT NULL PRIMARY KEY,  
13 - user_id integer NOT NULL DEFAULT '0',  
14 - "type" smallint NOT NULL DEFAULT '0',  
15 - name varchar(128) NOT NULL,  
16 - data text NOT NULL  
17 -);  
18 -  
19 -CREATE UNIQUE INDEX ix_searches_user_type_name ON searches (user_id, type, name);  
20 -  
21 -DROP TABLE messages;  
22 -  
23 -CREATE TABLE cache_index (  
24 - user_id integer NOT NULL,  
25 - mailbox varchar(255) NOT NULL,  
26 - changed datetime NOT NULL default '0000-00-00 00:00:00',  
27 - valid smallint NOT NULL DEFAULT '0',  
28 - data text NOT NULL,  
29 - PRIMARY KEY (user_id, mailbox)  
30 -);  
31 -  
32 -CREATE INDEX ix_cache_index_changed ON cache_index (changed);  
33 -  
34 -CREATE TABLE cache_thread (  
35 - user_id integer NOT NULL,  
36 - mailbox varchar(255) NOT NULL,  
37 - changed datetime NOT NULL default '0000-00-00 00:00:00',  
38 - data text NOT NULL,  
39 - PRIMARY KEY (user_id, mailbox)  
40 -);  
41 -  
42 -CREATE INDEX ix_cache_thread_changed ON cache_thread (changed);  
43 -  
44 -CREATE TABLE cache_messages (  
45 - user_id integer NOT NULL,  
46 - mailbox varchar(255) NOT NULL,  
47 - uid integer NOT NULL,  
48 - changed datetime NOT NULL default '0000-00-00 00:00:00',  
49 - data text NOT NULL,  
50 - flags integer NOT NULL DEFAULT '0',  
51 - PRIMARY KEY (user_id, mailbox, uid)  
52 -);  
53 -  
54 -CREATE INDEX ix_cache_messages_changed ON cache_messages (changed);  
1 --- Updates from version 0.7-beta  
2 -  
3 -DROP TABLE session;  
4 -CREATE TABLE session (  
5 - sess_id varchar(128) NOT NULL PRIMARY KEY,  
6 - created datetime NOT NULL default '0000-00-00 00:00:00',  
7 - changed datetime NOT NULL default '0000-00-00 00:00:00',  
8 - ip varchar(40) NOT NULL default '',  
9 - vars text NOT NULL  
10 -);  
11 -CREATE INDEX ix_session_changed ON session (changed);  
1 --- Updates from version 0.7  
2 -  
3 -CREATE TABLE contacts_tmp (  
4 - contact_id integer NOT NULL PRIMARY KEY,  
5 - user_id integer NOT NULL,  
6 - changed datetime NOT NULL default '0000-00-00 00:00:00',  
7 - del tinyint NOT NULL default '0',  
8 - name varchar(128) NOT NULL default '',  
9 - email text NOT NULL default '',  
10 - firstname varchar(128) NOT NULL default '',  
11 - surname varchar(128) NOT NULL default '',  
12 - vcard text NOT NULL default '',  
13 - words text NOT NULL default ''  
14 -);  
15 -  
16 -INSERT INTO contacts_tmp (contact_id, user_id, changed, del, name, email, firstname, surname, vcard, words)  
17 - SELECT contact_id, user_id, changed, del, name, email, firstname, surname, vcard, words FROM contacts;  
18 -  
19 -DROP TABLE contacts;  
20 -  
21 -CREATE TABLE contacts (  
22 - contact_id integer NOT NULL PRIMARY KEY,  
23 - user_id integer NOT NULL,  
24 - changed datetime NOT NULL default '0000-00-00 00:00:00',  
25 - del tinyint NOT NULL default '0',  
26 - name varchar(128) NOT NULL default '',  
27 - email text NOT NULL default '',  
28 - firstname varchar(128) NOT NULL default '',  
29 - surname varchar(128) NOT NULL default '',  
30 - vcard text NOT NULL default '',  
31 - words text NOT NULL default ''  
32 -);  
33 -  
34 -INSERT INTO contacts (contact_id, user_id, changed, del, name, email, firstname, surname, vcard, words)  
35 - SELECT contact_id, user_id, changed, del, name, email, firstname, surname, vcard, words FROM contacts_tmp;  
36 -  
37 -CREATE INDEX ix_contacts_user_id ON contacts(user_id, del);  
38 -DROP TABLE contacts_tmp;  
1 --- Updates from version 0.8  
2 -  
3 -DROP TABLE cache;  
4 -CREATE TABLE cache (  
5 - user_id integer NOT NULL default 0,  
6 - cache_key varchar(128) NOT NULL default '',  
7 - created datetime NOT NULL default '0000-00-00 00:00:00',  
8 - data text NOT NULL  
9 -);  
10 -  
11 -CREATE INDEX ix_cache_user_cache_key ON cache(user_id, cache_key);  
12 -CREATE INDEX ix_cache_created ON cache(created);  
13 -  
14 -CREATE TABLE tmp_users (  
15 - user_id integer NOT NULL PRIMARY KEY,  
16 - username varchar(128) NOT NULL default '',  
17 - mail_host varchar(128) NOT NULL default '',  
18 - created datetime NOT NULL default '0000-00-00 00:00:00',  
19 - last_login datetime DEFAULT NULL,  
20 - language varchar(5),  
21 - preferences text NOT NULL default ''  
22 -);  
23 -  
24 -INSERT INTO tmp_users (user_id, username, mail_host, created, last_login, language, preferences)  
25 - SELECT user_id, username, mail_host, created, last_login, language, preferences FROM users;  
26 -  
27 -DROP TABLE users;  
28 -  
29 -CREATE TABLE users (  
30 - user_id integer NOT NULL PRIMARY KEY,  
31 - username varchar(128) NOT NULL default '',  
32 - mail_host varchar(128) NOT NULL default '',  
33 - created datetime NOT NULL default '0000-00-00 00:00:00',  
34 - last_login datetime DEFAULT NULL,  
35 - language varchar(5),  
36 - preferences text NOT NULL default ''  
37 -);  
38 -  
39 -INSERT INTO users (user_id, username, mail_host, created, last_login, language, preferences)  
40 - SELECT user_id, username, mail_host, created, last_login, language, preferences FROM tmp_users;  
41 -  
42 -CREATE UNIQUE INDEX ix_users_username ON users(username, mail_host);  
43 -  
44 -CREATE INDEX ix_identities_email ON identities(email, del);  
1 --- Updates from version 0.9-beta  
2 -  
3 -CREATE TABLE IF NOT EXISTS system (  
4 - name varchar(64) NOT NULL PRIMARY KEY,  
5 - value text NOT NULL  
6 -);  
1 --- drop temp table created in 2012080700.sql  
2 -DROP TABLE IF EXISTS tmp_users;  
1 -CREATE TABLE cache_shared (  
2 - cache_key varchar(255) NOT NULL,  
3 - created datetime NOT NULL default '0000-00-00 00:00:00',  
4 - data text NOT NULL  
5 -);  
6 -  
7 -CREATE INDEX ix_cache_shared_cache_key ON cache_shared(cache_key);  
8 -CREATE INDEX ix_cache_shared_created ON cache_shared(created);  
1 -DROP TABLE cache_index;  
2 -DROP TABLE cache_thread;  
3 -DROP TABLE cache_messages;  
4 -  
5 -ALTER TABLE cache ADD expires datetime DEFAULT NULL;  
6 -DROP INDEX ix_cache_created;  
7 -  
8 -ALTER TABLE cache_shared ADD expires datetime DEFAULT NULL;  
9 -DROP INDEX ix_cache_shared_created;  
10 -  
11 -UPDATE cache SET expires = datetime(created, '+604800 seconds');  
12 -UPDATE cache_shared SET expires = datetime(created, '+604800 seconds');  
13 -  
14 -CREATE INDEX ix_cache_expires ON cache(expires);  
15 -CREATE INDEX ix_cache_shared_expires ON cache_shared(expires);  
16 -  
17 -CREATE TABLE cache_index (  
18 - user_id integer NOT NULL,  
19 - mailbox varchar(255) NOT NULL,  
20 - expires datetime DEFAULT NULL,  
21 - valid smallint NOT NULL DEFAULT '0',  
22 - data text NOT NULL,  
23 - PRIMARY KEY (user_id, mailbox)  
24 -);  
25 -  
26 -CREATE INDEX ix_cache_index_expires ON cache_index (expires);  
27 -  
28 -CREATE TABLE cache_thread (  
29 - user_id integer NOT NULL,  
30 - mailbox varchar(255) NOT NULL,  
31 - expires datetime DEFAULT NULL,  
32 - data text NOT NULL,  
33 - PRIMARY KEY (user_id, mailbox)  
34 -);  
35 -  
36 -CREATE INDEX ix_cache_thread_expires ON cache_thread (expires);  
37 -  
38 -CREATE TABLE cache_messages (  
39 - user_id integer NOT NULL,  
40 - mailbox varchar(255) NOT NULL,  
41 - uid integer NOT NULL,  
42 - expires datetime DEFAULT NULL,  
43 - data text NOT NULL,  
44 - flags integer NOT NULL DEFAULT '0',  
45 - PRIMARY KEY (user_id, mailbox, uid)  
46 -);  
47 -  
48 -CREATE INDEX ix_cache_messages_expires ON cache_messages (expires);  
1 -CREATE TABLE tmp_users (  
2 - user_id integer NOT NULL PRIMARY KEY,  
3 - username varchar(128) NOT NULL default '',  
4 - mail_host varchar(128) NOT NULL default '',  
5 - created datetime NOT NULL default '0000-00-00 00:00:00',  
6 - last_login datetime DEFAULT NULL,  
7 - failed_login datetime DEFAULT NULL,  
8 - failed_login_counter integer DEFAULT NULL,  
9 - language varchar(5),  
10 - preferences text NOT NULL default ''  
11 -);  
12 -  
13 -INSERT INTO tmp_users (user_id, username, mail_host, created, last_login, language, preferences)  
14 - SELECT user_id, username, mail_host, created, last_login, language, preferences FROM users;  
15 -  
16 -DROP TABLE users;  
17 -  
18 -CREATE TABLE users (  
19 - user_id integer NOT NULL PRIMARY KEY,  
20 - username varchar(128) NOT NULL default '',  
21 - mail_host varchar(128) NOT NULL default '',  
22 - created datetime NOT NULL default '0000-00-00 00:00:00',  
23 - last_login datetime DEFAULT NULL,  
24 - failed_login datetime DEFAULT NULL,  
25 - failed_login_counter integer DEFAULT NULL,  
26 - language varchar(5),  
27 - preferences text NOT NULL default ''  
28 -);  
29 -  
30 -INSERT INTO users (user_id, username, mail_host, created, last_login, language, preferences)  
31 - SELECT user_id, username, mail_host, created, last_login, language, preferences FROM tmp_users;  
32 -  
33 -CREATE UNIQUE INDEX ix_users_username ON users(username, mail_host);  
34 -  
35 -DROP TABLE tmp_users;  
1 -DROP TABLE session;  
2 -CREATE TABLE session (  
3 - sess_id varchar(128) NOT NULL PRIMARY KEY,  
4 - changed datetime NOT NULL default '0000-00-00 00:00:00',  
5 - ip varchar(40) NOT NULL default '',  
6 - vars text NOT NULL  
7 -);  
8 -  
9 -CREATE INDEX ix_session_changed ON session (changed);  
1 -DROP TABLE cache;  
2 -DROP TABLE cache_shared;  
3 -  
4 -CREATE TABLE cache (  
5 - user_id integer NOT NULL default 0,  
6 - cache_key varchar(128) NOT NULL default '',  
7 - expires datetime DEFAULT NULL,  
8 - data text NOT NULL,  
9 - PRIMARY KEY (user_id, cache_key)  
10 -);  
11 -  
12 -CREATE INDEX ix_cache_expires ON cache(expires);  
13 -  
14 -CREATE TABLE cache_shared (  
15 - cache_key varchar(255) NOT NULL,  
16 - expires datetime DEFAULT NULL,  
17 - data text NOT NULL,  
18 - PRIMARY KEY (cache_key)  
19 -);  
20 -  
21 -CREATE INDEX ix_cache_shared_expires ON cache_shared(expires);  
1 -CREATE TABLE filestore (  
2 - file_id integer PRIMARY KEY,  
3 - user_id integer NOT NULL,  
4 - filename varchar(128) NOT NULL,  
5 - mtime integer NOT NULL,  
6 - data text NOT NULL  
7 -);  
8 -  
9 -CREATE UNIQUE INDEX ix_filestore_user_id ON filestore(user_id, filename);  
1 -CREATE TABLE tmp_filestore (  
2 - file_id integer PRIMARY KEY,  
3 - user_id integer NOT NULL,  
4 - filename varchar(128) NOT NULL,  
5 - mtime integer NOT NULL,  
6 - data text NOT NULL  
7 -);  
8 -  
9 -INSERT INTO tmp_filestore (file_id, user_id, filename, mtime, data)  
10 - SELECT file_id, user_id, filename, mtime, data FROM filestore;  
11 -  
12 -DROP TABLE filestore;  
13 -  
14 -CREATE TABLE filestore (  
15 - file_id integer NOT NULL PRIMARY KEY,  
16 - user_id integer NOT NULL,  
17 - context varchar(32) NOT NULL,  
18 - filename varchar(128) NOT NULL,  
19 - mtime integer NOT NULL,  
20 - data text NOT NULL  
21 -);  
22 -  
23 -INSERT INTO filestore (file_id, user_id, filename, mtime, data, context)  
24 - SELECT file_id, user_id, filename, mtime, data, 'enigma' FROM tmp_filestore;  
25 -  
26 -CREATE UNIQUE INDEX ix_filestore_user_id ON filestore(user_id, context, filename);  
27 -  
28 -DROP TABLE tmp_filestore;  
29 -  
1 -CREATE TABLE tmp_users (  
2 - user_id integer NOT NULL PRIMARY KEY,  
3 - username varchar(128) NOT NULL default '',  
4 - mail_host varchar(128) NOT NULL default '',  
5 - created datetime NOT NULL default '0000-00-00 00:00:00',  
6 - last_login datetime DEFAULT NULL,  
7 - failed_login datetime DEFAULT NULL,  
8 - failed_login_counter integer DEFAULT NULL,  
9 - language varchar(16),  
10 - preferences text NOT NULL default ''  
11 -);  
12 -  
13 -INSERT INTO tmp_users (user_id, username, mail_host, created, last_login, failed_login, failed_login_counter, language, preferences)  
14 - SELECT user_id, username, mail_host, created, last_login, failed_login, failed_login_counter, language, preferences FROM users;  
15 -  
16 -DROP TABLE users;  
17 -  
18 -CREATE TABLE users (  
19 - user_id integer NOT NULL PRIMARY KEY,  
20 - username varchar(128) NOT NULL default '',  
21 - mail_host varchar(128) NOT NULL default '',  
22 - created datetime NOT NULL default '0000-00-00 00:00:00',  
23 - last_login datetime DEFAULT NULL,  
24 - failed_login datetime DEFAULT NULL,  
25 - failed_login_counter integer DEFAULT NULL,  
26 - language varchar(16),  
27 - preferences text NOT NULL default ''  
28 -);  
29 -  
30 -INSERT INTO users (user_id, username, mail_host, created, last_login, failed_login, failed_login_counter, language, preferences)  
31 - SELECT user_id, username, mail_host, created, last_login, failed_login, failed_login_counter, language, preferences FROM tmp_users;  
32 -  
33 -CREATE UNIQUE INDEX ix_users_username ON users(username, mail_host);  
34 -  
35 -DROP TABLE tmp_users;  
36 -  
37 -CREATE TABLE tmp_dictionary (  
38 - user_id integer DEFAULT NULL,  
39 - language varchar(16) NOT NULL,  
40 - data text NOT NULL  
41 -);  
42 -  
43 -INSERT INTO tmp_dictionary (user_id, language, data) SELECT user_id, language, data FROM dictionary;  
44 -  
45 -DROP TABLE dictionary;  
46 -  
47 -CREATE TABLE dictionary (  
48 - user_id integer DEFAULT NULL,  
49 - language varchar(16) NOT NULL,  
50 - data text NOT NULL  
51 -);  
52 -  
53 -INSERT INTO dictionary (user_id, language, data) SELECT user_id, language, data FROM tmp_dictionary;  
54 -  
55 -CREATE UNIQUE INDEX ix_dictionary_user_language ON dictionary (user_id, language);  
56 -  
57 -DROP TABLE tmp_dictionary;  
1 -CREATE TABLE collected_addresses (  
2 - address_id integer NOT NULL PRIMARY KEY,  
3 - user_id integer NOT NULL,  
4 - changed datetime NOT NULL default '0000-00-00 00:00:00',  
5 - name varchar(255) NOT NULL default '',  
6 - email varchar(255) NOT NULL,  
7 - "type" integer NOT NULL  
8 -);  
9 -  
10 -CREATE UNIQUE INDEX ix_collected_addresses_user_id ON collected_addresses(user_id, "type", email);  
1 -CREATE TABLE tmp_users (  
2 - user_id integer NOT NULL PRIMARY KEY,  
3 - username varchar(128) NOT NULL default '',  
4 - mail_host varchar(128) NOT NULL default '',  
5 - created datetime NOT NULL default '0000-00-00 00:00:00',  
6 - last_login datetime DEFAULT NULL,  
7 - failed_login datetime DEFAULT NULL,  
8 - failed_login_counter integer DEFAULT NULL,  
9 - language varchar(16),  
10 - preferences text DEFAULT NULL  
11 -);  
12 -  
13 -INSERT INTO tmp_users (user_id, username, mail_host, created, last_login, failed_login, failed_login_counter, language, preferences)  
14 - SELECT user_id, username, mail_host, created, last_login, failed_login, failed_login_counter, language, preferences FROM users;  
15 -  
16 -DROP TABLE users;  
17 -  
18 -CREATE TABLE users (  
19 - user_id integer NOT NULL PRIMARY KEY,  
20 - username varchar(128) NOT NULL default '',  
21 - mail_host varchar(128) NOT NULL default '',  
22 - created datetime NOT NULL default '0000-00-00 00:00:00',  
23 - last_login datetime DEFAULT NULL,  
24 - failed_login datetime DEFAULT NULL,  
25 - failed_login_counter integer DEFAULT NULL,  
26 - language varchar(16),  
27 - preferences text DEFAULT NULL  
28 -);  
29 -  
30 -INSERT INTO users (user_id, username, mail_host, created, last_login, failed_login, failed_login_counter, language, preferences)  
31 - SELECT user_id, username, mail_host, created, last_login, failed_login, failed_login_counter, language, preferences FROM tmp_users;  
32 -  
33 -CREATE UNIQUE INDEX ix_users_username ON users(username, mail_host);  
34 -  
35 -DROP TABLE tmp_users;  
1 <?php 1 <?php
2 2
3 -/*  
4 - +-----------------------------------------------------------------------+  
5 - | Local configuration for the Roundcube Webmail installation. |  
6 - | |  
7 - | This is a sample configuration file only containing the minimum |  
8 - | setup required for a functional installation. Copy more options |  
9 - | from defaults.inc.php to this file to override the defaults. |  
10 - | |  
11 - | This file is part of the Roundcube Webmail client |  
12 - | Copyright (C) The Roundcube Dev Team |  
13 - | |  
14 - | Licensed under the GNU General Public License version 3 or |  
15 - | any later version with exceptions for skins & plugins. |  
16 - | See the README file for a full license statement. |  
17 - +-----------------------------------------------------------------------+  
18 -*/  
19 -  
20 -$config = []; 3 +/* Local configuration for Roundcube Webmail */
  4 +
  5 +// ----------------------------------
  6 +
  7 +// SQL DATABASE
  8 +
  9 +// ----------------------------------
21 10
22 // Database connection string (DSN) for read+write operations 11 // Database connection string (DSN) for read+write operations
  12 +
23 // Format (compatible with PEAR MDB2): db_provider://user:password@host/database 13 // Format (compatible with PEAR MDB2): db_provider://user:password@host/database
  14 +
24 // Currently supported db_providers: mysql, pgsql, sqlite, mssql, sqlsrv, oracle 15 // Currently supported db_providers: mysql, pgsql, sqlite, mssql, sqlsrv, oracle
  16 +
25 // For examples see http://pear.php.net/manual/en/package.database.mdb2.intro-dsn.php 17 // For examples see http://pear.php.net/manual/en/package.database.mdb2.intro-dsn.php
26 -// NOTE: for SQLite use absolute path (Linux): 'sqlite:////full/path/to/sqlite.db?mode=0646' 18 +
  19 +// Note: for SQLite use absolute path (Linux): 'sqlite:////full/path/to/sqlite.db?mode=0646'
  20 +
27 // or (Windows): 'sqlite:///C:/full/path/to/sqlite.db' 21 // or (Windows): 'sqlite:///C:/full/path/to/sqlite.db'
28 -$config['db_dsnw'] = 'mysql://roundcube:pass@localhost/roundcubemail'; 22 +
  23 +// Note: Various drivers support various additional arguments for connection,
  24 +
  25 +// for Mysql: key, cipher, cert, capath, ca, verify_server_cert,
  26 +
  27 +// for Postgres: application_name, sslmode, sslcert, sslkey, sslrootcert, sslcrl, sslcompression, service.
  28 +
  29 +// e.g. 'mysql://roundcube:@localhost/roundcubemail?verify_server_cert=false'
  30 +
  31 +$config['db_dsnw'] = 'mysql://roundcubemail:mfmzCweHmZPfBSPK@localhost/roundcubemail';
  32 +
  33 +// you can define specific table (and sequence) names prefix
  34 +
  35 +$config['db_prefix'] = '';
  36 +
  37 +// ----------------------------------
  38 +
  39 +// IMAP
  40 +
  41 +// ----------------------------------
29 42
30 // The IMAP host chosen to perform the log-in. 43 // The IMAP host chosen to perform the log-in.
  44 +
31 // Leave blank to show a textbox at login, give a list of hosts 45 // Leave blank to show a textbox at login, give a list of hosts
  46 +
32 // to display a pulldown menu or set one host as string. 47 // to display a pulldown menu or set one host as string.
  48 +
33 // Enter hostname with prefix ssl:// to use Implicit TLS, or use 49 // Enter hostname with prefix ssl:// to use Implicit TLS, or use
  50 +
34 // prefix tls:// to use STARTTLS. 51 // prefix tls:// to use STARTTLS.
  52 +
35 // Supported replacement variables: 53 // Supported replacement variables:
  54 +
36 // %n - hostname ($_SERVER['SERVER_NAME']) 55 // %n - hostname ($_SERVER['SERVER_NAME'])
  56 +
37 // %t - hostname without the first part 57 // %t - hostname without the first part
  58 +
38 // %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part) 59 // %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
  60 +
39 // %s - domain name after the '@' from e-mail address provided at login screen 61 // %s - domain name after the '@' from e-mail address provided at login screen
  62 +
40 // For example %n = mail.domain.tld, %t = domain.tld 63 // For example %n = mail.domain.tld, %t = domain.tld
41 -$config['default_host'] = 'localhost'; 64 +
  65 +// WARNING: After hostname change update of mail_host column in users table is
  66 +
  67 +// required to match old user data records with the new host.
  68 +
  69 +$config['default_host'] = [];
  70 +
  71 +// TCP port used for IMAP connections
  72 +
  73 +$config['default_port'] = 993;
  74 +
  75 +// ----------------------------------
  76 +
  77 +// SMTP
  78 +
  79 +// ----------------------------------
42 80
43 // SMTP server host (for sending mails). 81 // SMTP server host (for sending mails).
  82 +
44 // Enter hostname with prefix ssl:// to use Implicit TLS, or use 83 // Enter hostname with prefix ssl:// to use Implicit TLS, or use
  84 +
45 // prefix tls:// to use STARTTLS. 85 // prefix tls:// to use STARTTLS.
  86 +
46 // Supported replacement variables: 87 // Supported replacement variables:
  88 +
47 // %h - user's IMAP hostname 89 // %h - user's IMAP hostname
  90 +
48 // %n - hostname ($_SERVER['SERVER_NAME']) 91 // %n - hostname ($_SERVER['SERVER_NAME'])
  92 +
49 // %t - hostname without the first part 93 // %t - hostname without the first part
  94 +
50 // %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part) 95 // %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
  96 +
51 // %z - IMAP domain (IMAP hostname without the first part) 97 // %z - IMAP domain (IMAP hostname without the first part)
  98 +
52 // For example %n = mail.domain.tld, %t = domain.tld 99 // For example %n = mail.domain.tld, %t = domain.tld
53 -// To specify different SMTP servers for different IMAP hosts provide an array  
54 -// of IMAP host (no prefix or port) and SMTP server e.g. ['imap.example.com' => 'smtp.example.net']  
55 -$config['smtp_server'] = 'localhost';  
56 100
57 -// SMTP port. Use 25 for cleartext, 465 for Implicit TLS, or 587 for STARTTLS (default)  
58 -$config['smtp_port'] = 587; 101 +// To specify different SMTP servers for different IMAP hosts provide an array
59 102
60 -// SMTP username (if required) if you use %u as the username Roundcube  
61 -// will use the current username for login  
62 -$config['smtp_user'] = '%u'; 103 +// of IMAP host (no prefix or port) and SMTP server e.g. ['imap.example.com' => 'smtp.example.net']
63 104
64 -// SMTP password (if required) if you use %p as the password Roundcube  
65 -// will use the current user's password for login  
66 -$config['smtp_pass'] = '%p'; 105 +$config['smtp_server'] = [];
67 106
68 // provide an URL where a user can get support for this Roundcube installation 107 // provide an URL where a user can get support for this Roundcube installation
  108 +
69 // PLEASE DO NOT LINK TO THE ROUNDCUBE.NET WEBSITE HERE! 109 // PLEASE DO NOT LINK TO THE ROUNDCUBE.NET WEBSITE HERE!
70 -$config['support_url'] = ''; 110 +
  111 +$config['support_url'] = 'https://test-mail.shopk.com/';
  112 +
  113 +// This key is used for encrypting purposes, like storing of imap password
  114 +
  115 +// in the session. For historical reasons it's called DES_key, but it's used
  116 +
  117 +// with any configured cipher_method (see below).
  118 +
  119 +// For the default cipher_method a required key length is 24 characters.
  120 +
  121 +$config['des_key'] = 'EASUBYJVx0cDPKV7zmC2jdiD';
71 122
72 // Name your service. This is displayed on the login screen and in the window title 123 // Name your service. This is displayed on the login screen and in the window title
73 -$config['product_name'] = 'Roundcube Webmail';  
74 124
75 -// This key is used to encrypt the users imap password which is stored  
76 -// in the session record. For the default cipher method it must be  
77 -// exactly 24 characters long.  
78 -// YOUR KEY MUST BE DIFFERENT THAN THE SAMPLE VALUE FOR SECURITY REASONS  
79 -$config['des_key'] = 'rcmail-!24ByteDESkey*Str'; 125 +$config['product_name'] = 'shopk email';
  126 +
  127 +// ----------------------------------
  128 +
  129 +// PLUGINS
  130 +
  131 +// ----------------------------------
80 132
81 // List of active plugins (in plugins/ directory) 133 // List of active plugins (in plugins/ directory)
82 -$config['plugins'] = [  
83 - 'archive',  
84 - 'zipdownload',  
85 -];  
86 134
87 -// skin name: folder from skins/  
88 -$config['skin'] = 'elastic'; 135 +$config['plugins'] = ['acl', 'additional_message_headers', /*'archive',*/ 'attachment_reminder', /* 'autologon', 'database_attachments','debug_logger',*/ 'emoticons', /*'enigma',*/ 'example_addressbook', 'filesystem_attachments', /*'help',*/ 'hide_blockquote',/* 'http_authentication',*/ 'identicon', 'identity_select', 'jqueryui', /* 'krb_authentication','managesieve',*/ 'markasjunk', 'new_user_dialog', 'new_user_identity', 'newmail_notifier', /*'password',*/ 'reconnect', 'redundant_attachments', 'show_additional_headers', /* 'squirrelmail_usercopy', 'subscriptions_option','userinfo',*/ 'vcard_attachments', 'virtuser_file', 'virtuser_query', 'zipdownload'];
  136 +
  137 +// the default locale setting (leave empty for auto-detection)
  138 +
  139 +// RFC1766 formatted language name like en_US, de_DE, de_CH, fr_FR, pt_BR
  140 +
  141 +$config['language'] = 'zh-CN';
  142 +
  143 +
  144 +$config['mime_types'] = __DIR__.'/mime.types';
  145 +
  146 +
  147 +$config['enable_installer'] = false;
@@ -37,27 +37,27 @@ class help extends rcube_plugin @@ -37,27 +37,27 @@ class help extends rcube_plugin
37 37
38 function startup($args) 38 function startup($args)
39 { 39 {
40 - // TODO::帮助按钮  
41 -// $rcmail = rcmail::get_instance();  
42 -//  
43 -// if (!$rcmail->output->framed) {  
44 -// // add taskbar button  
45 -// $this->add_button([  
46 -// 'command' => 'help',  
47 -// 'class' => 'button-help',  
48 -// 'classsel' => 'button-help button-selected',  
49 -// 'innerclass' => 'button-inner',  
50 -// 'label' => 'help.help',  
51 -// 'type' => 'link',  
52 -// ], 'taskbar'  
53 -// );  
54 -//  
55 -// $this->include_script('help.js');  
56 -// $rcmail->output->set_env('help_open_extwin', $rcmail->config->get('help_open_extwin', false), true);  
57 -// }  
58 -//  
59 -// // add style for taskbar button (must be here) and Help UI  
60 -// $this->include_stylesheet($this->local_skin_path() . '/help.css'); 40 +
  41 + $rcmail = rcmail::get_instance();
  42 +
  43 + if (!$rcmail->output->framed) {
  44 + // add taskbar button
  45 + $this->add_button([
  46 + 'command' => 'help',
  47 + 'class' => 'button-help',
  48 + 'classsel' => 'button-help button-selected',
  49 + 'innerclass' => 'button-inner',
  50 + 'label' => 'help.help',
  51 + 'type' => 'link',
  52 + ], 'taskbar'
  53 + );
  54 +
  55 + $this->include_script('help.js');
  56 + $rcmail->output->set_env('help_open_extwin', $rcmail->config->get('help_open_extwin', false), true);
  57 + }
  58 +
  59 + // add style for taskbar button (must be here) and Help UI
  60 + $this->include_stylesheet($this->local_skin_path() . '/help.css');
61 } 61 }
62 62
63 function action() 63 function action()
@@ -2369,19 +2369,15 @@ EOF; @@ -2369,19 +2369,15 @@ EOF;
2369 $js_default_host = rcube_email_server_address::getKeyValue(); 2369 $js_default_host = rcube_email_server_address::getKeyValue();
2370 $_script = "<script> 2370 $_script = "<script>
2371 var _default_hosts = ".json_encode($js_default_host,JSON_UNESCAPED_UNICODE)."; 2371 var _default_hosts = ".json_encode($js_default_host,JSON_UNESCAPED_UNICODE).";
2372 -$(\"#rcmloginuser\").change(function() {  
2373 - auto_host($(this).val());  
2374 -});  
2375 -$(\"#rcmloginuser\").keyup(function() {  
2376 - auto_host($(this).val());  
2377 -}); 2372 +$(\"#rcmloginuser\").change(function() {auto_host($(this).val());});
  2373 +$(\"#rcmloginuser\").keyup(function() {auto_host($(this).val());});
  2374 +$(\"#rcmloginuser\").blur(function() {auto_host($(this).val());});
  2375 +$('body').mousedown(function() {auto_host($(\"#rcmloginuser\").val());});
2378 function auto_host(_user){ 2376 function auto_host(_user){
2379 - _user = _user.split('@');  
2380 - if(_user[1]){  
2381 - if(_default_hosts[_user[1]]){ 2377 + _user = _user.trim().split('@');
  2378 + if(_user[1] && _default_hosts[_user[1]]){
2382 $(\"#rcmloginhost\").val(_default_hosts[_user[1]]); 2379 $(\"#rcmloginhost\").val(_default_hosts[_user[1]]);
2383 } 2380 }
2384 - }  
2385 } 2381 }
2386 </script>"; 2382 </script>";
2387 $this->add_script(mb_substr($_script,8,-9),'foot'); 2383 $this->add_script(mb_substr($_script,8,-9),'foot');
  1 +网站根目录 /public_html
  2 +
1 linux 服务器 3 linux 服务器
2 public_html目录下没有skins和plugins两个目录的软链接请在 public_html目录下面执行以下命令 4 public_html目录下没有skins和plugins两个目录的软链接请在 public_html目录下面执行以下命令
3 ln -s ../skins skins 5 ln -s ../skins skins