commit | author | age
|
107bde
|
1 |
CREATE TABLE [dbo].[cache] (
|
T |
2 |
[user_id] [int] NOT NULL ,
|
|
3 |
[cache_key] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
|
|
4 |
[created] [datetime] NOT NULL ,
|
60b6d7
|
5 |
[expires] [datetime] NULL ,
|
107bde
|
6 |
[data] [text] COLLATE Latin1_General_CI_AI NOT NULL
|
T |
7 |
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
8 |
GO
|
|
9 |
|
50abd5
|
10 |
CREATE TABLE [dbo].[cache_shared] (
|
AM |
11 |
[cache_key] [varchar] (255) COLLATE Latin1_General_CI_AI NOT NULL ,
|
|
12 |
[created] [datetime] NOT NULL ,
|
60b6d7
|
13 |
[expires] [datetime] NULL ,
|
50abd5
|
14 |
[data] [text] COLLATE Latin1_General_CI_AI NOT NULL
|
AM |
15 |
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
16 |
GO
|
|
17 |
|
80152b
|
18 |
CREATE TABLE [dbo].[cache_index] (
|
A |
19 |
[user_id] [int] NOT NULL ,
|
|
20 |
[mailbox] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
|
60b6d7
|
21 |
[expires] [datetime] NULL ,
|
609d39
|
22 |
[valid] [char] (1) COLLATE Latin1_General_CI_AI NOT NULL ,
|
80152b
|
23 |
[data] [text] COLLATE Latin1_General_CI_AI NOT NULL
|
A |
24 |
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
25 |
GO
|
|
26 |
|
|
27 |
CREATE TABLE [dbo].[cache_thread] (
|
|
28 |
[user_id] [int] NOT NULL ,
|
|
29 |
[mailbox] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
|
60b6d7
|
30 |
[expires] [datetime] NULL ,
|
80152b
|
31 |
[data] [text] COLLATE Latin1_General_CI_AI NOT NULL
|
A |
32 |
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
33 |
GO
|
|
34 |
|
|
35 |
CREATE TABLE [dbo].[cache_messages] (
|
|
36 |
[user_id] [int] NOT NULL ,
|
|
37 |
[mailbox] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
|
|
38 |
[uid] [int] NOT NULL ,
|
60b6d7
|
39 |
[expires] [datetime] NULL ,
|
ccce87
|
40 |
[data] [text] COLLATE Latin1_General_CI_AI NOT NULL ,
|
A |
41 |
[flags] [int] NOT NULL
|
80152b
|
42 |
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
A |
43 |
GO
|
|
44 |
|
107bde
|
45 |
CREATE TABLE [dbo].[contacts] (
|
T |
46 |
[contact_id] [int] IDENTITY (1, 1) NOT NULL ,
|
|
47 |
[user_id] [int] NOT NULL ,
|
|
48 |
[changed] [datetime] NOT NULL ,
|
|
49 |
[del] [char] (1) COLLATE Latin1_General_CI_AI NOT NULL ,
|
|
50 |
[name] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
|
6237c9
|
51 |
[email] [varchar] (8000) COLLATE Latin1_General_CI_AI NOT NULL ,
|
107bde
|
52 |
[firstname] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
|
T |
53 |
[surname] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
|
3e2637
|
54 |
[vcard] [text] COLLATE Latin1_General_CI_AI NULL ,
|
T |
55 |
[words] [text] COLLATE Latin1_General_CI_AI NULL
|
107bde
|
56 |
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
T |
57 |
GO
|
|
58 |
|
96f965
|
59 |
CREATE TABLE [dbo].[contactgroups] (
|
T |
60 |
[contactgroup_id] [int] IDENTITY (1, 1) NOT NULL ,
|
|
61 |
[user_id] [int] NOT NULL ,
|
|
62 |
[changed] [datetime] NOT NULL ,
|
|
63 |
[del] [char] (1) COLLATE Latin1_General_CI_AI NOT NULL ,
|
|
64 |
[name] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL
|
ac1898
|
65 |
) ON [PRIMARY]
|
96f965
|
66 |
GO
|
T |
67 |
|
|
68 |
CREATE TABLE [dbo].[contactgroupmembers] (
|
|
69 |
[contactgroup_id] [int] NOT NULL ,
|
|
70 |
[contact_id] [int] NOT NULL ,
|
|
71 |
[created] [datetime] NOT NULL
|
ac1898
|
72 |
) ON [PRIMARY]
|
96f965
|
73 |
GO
|
T |
74 |
|
107bde
|
75 |
CREATE TABLE [dbo].[identities] (
|
T |
76 |
[identity_id] [int] IDENTITY (1, 1) NOT NULL ,
|
|
77 |
[user_id] [int] NOT NULL ,
|
a35062
|
78 |
[changed] [datetime] NOT NULL ,
|
107bde
|
79 |
[del] [char] (1) COLLATE Latin1_General_CI_AI NOT NULL ,
|
T |
80 |
[standard] [char] (1) COLLATE Latin1_General_CI_AI NOT NULL ,
|
|
81 |
[name] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
|
|
82 |
[organization] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
|
|
83 |
[email] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
|
|
84 |
[reply-to] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
|
|
85 |
[bcc] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
|
7c6bc1
|
86 |
[signature] [text] COLLATE Latin1_General_CI_AI NULL,
|
97840c
|
87 |
[html_signature] [char] (1) COLLATE Latin1_General_CI_AI NOT NULL
|
107bde
|
88 |
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
T |
89 |
GO
|
|
90 |
|
|
91 |
CREATE TABLE [dbo].[session] (
|
b8ae0e
|
92 |
[sess_id] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
|
107bde
|
93 |
[created] [datetime] NOT NULL ,
|
T |
94 |
[changed] [datetime] NULL ,
|
84d06e
|
95 |
[ip] [varchar] (40) COLLATE Latin1_General_CI_AI NOT NULL ,
|
107bde
|
96 |
[vars] [text] COLLATE Latin1_General_CI_AI NOT NULL
|
T |
97 |
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
98 |
GO
|
|
99 |
|
|
100 |
CREATE TABLE [dbo].[users] (
|
|
101 |
[user_id] [int] IDENTITY (1, 1) NOT NULL ,
|
|
102 |
[username] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
|
|
103 |
[mail_host] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
|
|
104 |
[created] [datetime] NOT NULL ,
|
e2402e
|
105 |
[last_login] [datetime] NULL ,
|
a15d87
|
106 |
[failed_login] [datetime] NULL ,
|
AM |
107 |
[failed_login_counter] [int] NULL ,
|
debdda
|
108 |
[language] [varchar] (5) COLLATE Latin1_General_CI_AI NULL ,
|
7c6bc1
|
109 |
[preferences] [text] COLLATE Latin1_General_CI_AI NULL
|
107bde
|
110 |
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
T |
111 |
GO
|
|
112 |
|
66df08
|
113 |
CREATE TABLE [dbo].[dictionary] (
|
A |
114 |
[user_id] [int] ,
|
|
115 |
[language] [varchar] (5) COLLATE Latin1_General_CI_AI NOT NULL ,
|
|
116 |
[data] [text] COLLATE Latin1_General_CI_AI NOT NULL
|
|
117 |
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
118 |
GO
|
|
119 |
|
f8e48d
|
120 |
CREATE TABLE [dbo].[searches] (
|
A |
121 |
[search_id] [int] IDENTITY (1, 1) NOT NULL ,
|
|
122 |
[user_id] [int] NOT NULL ,
|
|
123 |
[type] [tinyint] NOT NULL ,
|
|
124 |
[name] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
|
|
125 |
[data] [text] COLLATE Latin1_General_CI_AI NOT NULL
|
|
126 |
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
107bde
|
127 |
GO
|
T |
128 |
|
b7e7c8
|
129 |
CREATE TABLE [dbo].[system] (
|
AM |
130 |
[name] [varchar] (64) COLLATE Latin1_General_CI_AI NOT NULL ,
|
|
131 |
[value] [text] COLLATE Latin1_General_CI_AI NOT NULL
|
|
132 |
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
|
133 |
GO
|
|
134 |
|
80152b
|
135 |
ALTER TABLE [dbo].[cache_index] WITH NOCHECK ADD
|
A |
136 |
PRIMARY KEY CLUSTERED
|
|
137 |
(
|
|
138 |
[user_id],[mailbox]
|
|
139 |
) ON [PRIMARY]
|
|
140 |
GO
|
|
141 |
|
|
142 |
ALTER TABLE [dbo].[cache_thread] WITH NOCHECK ADD
|
|
143 |
PRIMARY KEY CLUSTERED
|
|
144 |
(
|
|
145 |
[user_id],[mailbox]
|
|
146 |
) ON [PRIMARY]
|
|
147 |
GO
|
|
148 |
|
|
149 |
ALTER TABLE [dbo].[cache_messages] WITH NOCHECK ADD
|
|
150 |
PRIMARY KEY CLUSTERED
|
|
151 |
(
|
|
152 |
[user_id],[mailbox],[uid]
|
|
153 |
) ON [PRIMARY]
|
|
154 |
GO
|
|
155 |
|
107bde
|
156 |
ALTER TABLE [dbo].[contacts] WITH NOCHECK ADD
|
T |
157 |
CONSTRAINT [PK_contacts_contact_id] PRIMARY KEY CLUSTERED
|
|
158 |
(
|
|
159 |
[contact_id]
|
90f7aa
|
160 |
) ON [PRIMARY]
|
107bde
|
161 |
GO
|
T |
162 |
|
96f965
|
163 |
ALTER TABLE [dbo].[contactgroups] WITH NOCHECK ADD
|
T |
164 |
CONSTRAINT [PK_contactgroups_contactgroup_id] PRIMARY KEY CLUSTERED
|
|
165 |
(
|
|
166 |
[contactgroup_id]
|
90f7aa
|
167 |
) ON [PRIMARY]
|
96f965
|
168 |
GO
|
T |
169 |
|
|
170 |
ALTER TABLE [dbo].[contactgroupmembers] WITH NOCHECK ADD
|
|
171 |
CONSTRAINT [PK_contactgroupmembers_id] PRIMARY KEY CLUSTERED
|
|
172 |
(
|
|
173 |
[contactgroup_id], [contact_id]
|
90f7aa
|
174 |
) ON [PRIMARY]
|
96f965
|
175 |
GO
|
T |
176 |
|
107bde
|
177 |
ALTER TABLE [dbo].[identities] WITH NOCHECK ADD
|
T |
178 |
PRIMARY KEY CLUSTERED
|
|
179 |
(
|
|
180 |
[identity_id]
|
90f7aa
|
181 |
) ON [PRIMARY]
|
107bde
|
182 |
GO
|
T |
183 |
|
|
184 |
ALTER TABLE [dbo].[session] WITH NOCHECK ADD
|
|
185 |
CONSTRAINT [PK_session_sess_id] PRIMARY KEY CLUSTERED
|
|
186 |
(
|
|
187 |
[sess_id]
|
90f7aa
|
188 |
) ON [PRIMARY]
|
107bde
|
189 |
GO
|
T |
190 |
|
|
191 |
ALTER TABLE [dbo].[users] WITH NOCHECK ADD
|
|
192 |
CONSTRAINT [PK_users_user_id] PRIMARY KEY CLUSTERED
|
|
193 |
(
|
|
194 |
[user_id]
|
90f7aa
|
195 |
) ON [PRIMARY]
|
f8e48d
|
196 |
GO
|
A |
197 |
|
|
198 |
ALTER TABLE [dbo].[searches] WITH NOCHECK ADD
|
|
199 |
CONSTRAINT [PK_searches_search_id] PRIMARY KEY CLUSTERED
|
|
200 |
(
|
|
201 |
[search_id]
|
b7e7c8
|
202 |
) ON [PRIMARY]
|
AM |
203 |
GO
|
|
204 |
|
|
205 |
ALTER TABLE [dbo].[system] WITH NOCHECK ADD
|
|
206 |
CONSTRAINT [PK_system_name] PRIMARY KEY CLUSTERED
|
|
207 |
(
|
|
208 |
[name]
|
f8e48d
|
209 |
) ON [PRIMARY]
|
107bde
|
210 |
GO
|
T |
211 |
|
|
212 |
ALTER TABLE [dbo].[cache] ADD
|
|
213 |
CONSTRAINT [DF_cache_user_id] DEFAULT ('0') FOR [user_id],
|
|
214 |
CONSTRAINT [DF_cache_cache_key] DEFAULT ('') FOR [cache_key],
|
|
215 |
CONSTRAINT [DF_cache_created] DEFAULT (getdate()) FOR [created]
|
|
216 |
GO
|
|
217 |
|
60b6d7
|
218 |
ALTER TABLE [dbo].[cache_shared] ADD
|
AM |
219 |
CONSTRAINT [DF_cache_shared_created] DEFAULT (getdate()) FOR [created]
|
|
220 |
GO
|
|
221 |
|
|
222 |
ALTER TABLE [dbo].[cache_index] ADD
|
|
223 |
CONSTRAINT [DF_cache_index_valid] DEFAULT ('0') FOR [valid]
|
|
224 |
GO
|
|
225 |
|
|
226 |
ALTER TABLE [dbo].[cache_messages] ADD
|
|
227 |
CONSTRAINT [DF_cache_messages_flags] DEFAULT (0) FOR [flags]
|
|
228 |
GO
|
|
229 |
|
90f7aa
|
230 |
CREATE INDEX [IX_cache_user_id] ON [dbo].[cache]([user_id]) ON [PRIMARY]
|
107bde
|
231 |
GO
|
T |
232 |
|
90f7aa
|
233 |
CREATE INDEX [IX_cache_cache_key] ON [dbo].[cache]([cache_key]) ON [PRIMARY]
|
107bde
|
234 |
GO
|
T |
235 |
|
90f7aa
|
236 |
CREATE INDEX [IX_cache_shared_cache_key] ON [dbo].[cache_shared]([cache_key]) ON [PRIMARY]
|
80152b
|
237 |
GO
|
A |
238 |
|
90f7aa
|
239 |
CREATE INDEX [IX_cache_index_user_id] ON [dbo].[cache_index]([user_id]) ON [PRIMARY]
|
80152b
|
240 |
GO
|
A |
241 |
|
90f7aa
|
242 |
CREATE INDEX [IX_cache_thread_user_id] ON [dbo].[cache_thread]([user_id]) ON [PRIMARY]
|
80152b
|
243 |
GO
|
A |
244 |
|
90f7aa
|
245 |
CREATE INDEX [IX_cache_messages_user_id] ON [dbo].[cache_messages]([user_id]) ON [PRIMARY]
|
80152b
|
246 |
GO
|
A |
247 |
|
60b6d7
|
248 |
CREATE INDEX [IX_cache_expires] ON [dbo].[cache]([expires]) ON [PRIMARY]
|
AM |
249 |
GO
|
|
250 |
|
|
251 |
CREATE INDEX [IX_cache_shared_expires] ON [dbo].[cache_shared]([expires]) ON [PRIMARY]
|
|
252 |
GO
|
|
253 |
|
|
254 |
CREATE INDEX [IX_cache_index_expires] ON [dbo].[cache_index]([expires]) ON [PRIMARY]
|
|
255 |
GO
|
|
256 |
|
|
257 |
CREATE INDEX [IX_cache_thread_expires] ON [dbo].[cache_thread]([expires]) ON [PRIMARY]
|
|
258 |
GO
|
|
259 |
|
|
260 |
CREATE INDEX [IX_cache_messages_expires] ON [dbo].[cache_messages]([expires]) ON [PRIMARY]
|
e4d9f0
|
261 |
GO
|
A |
262 |
|
107bde
|
263 |
ALTER TABLE [dbo].[contacts] ADD
|
T |
264 |
CONSTRAINT [DF_contacts_user_id] DEFAULT (0) FOR [user_id],
|
|
265 |
CONSTRAINT [DF_contacts_changed] DEFAULT (getdate()) FOR [changed],
|
|
266 |
CONSTRAINT [DF_contacts_del] DEFAULT ('0') FOR [del],
|
|
267 |
CONSTRAINT [DF_contacts_name] DEFAULT ('') FOR [name],
|
|
268 |
CONSTRAINT [DF_contacts_email] DEFAULT ('') FOR [email],
|
|
269 |
CONSTRAINT [DF_contacts_firstname] DEFAULT ('') FOR [firstname],
|
|
270 |
CONSTRAINT [DF_contacts_surname] DEFAULT ('') FOR [surname],
|
|
271 |
CONSTRAINT [CK_contacts_del] CHECK ([del] = '1' or [del] = '0')
|
|
272 |
GO
|
|
273 |
|
90f7aa
|
274 |
CREATE INDEX [IX_contacts_user_id] ON [dbo].[contacts]([user_id]) ON [PRIMARY]
|
107bde
|
275 |
GO
|
T |
276 |
|
96f965
|
277 |
ALTER TABLE [dbo].[contactgroups] ADD
|
T |
278 |
CONSTRAINT [DF_contactgroups_user_id] DEFAULT (0) FOR [user_id],
|
|
279 |
CONSTRAINT [DF_contactgroups_changed] DEFAULT (getdate()) FOR [changed],
|
|
280 |
CONSTRAINT [DF_contactgroups_del] DEFAULT ('0') FOR [del],
|
|
281 |
CONSTRAINT [DF_contactgroups_name] DEFAULT ('') FOR [name],
|
|
282 |
CONSTRAINT [CK_contactgroups_del] CHECK ([del] = '1' or [del] = '0')
|
|
283 |
GO
|
|
284 |
|
f63ff7
|
285 |
CREATE INDEX [IX_contactgroups_user_id] ON [dbo].[contactgroups]([user_id]) ON [PRIMARY]
|
96f965
|
286 |
GO
|
T |
287 |
|
|
288 |
ALTER TABLE [dbo].[contactgroupmembers] ADD
|
|
289 |
CONSTRAINT [DF_contactgroupmembers_contactgroup_id] DEFAULT (0) FOR [contactgroup_id],
|
|
290 |
CONSTRAINT [DF_contactgroupmembers_contact_id] DEFAULT (0) FOR [contact_id],
|
|
291 |
CONSTRAINT [DF_contactgroupmembers_created] DEFAULT (getdate()) FOR [created]
|
|
292 |
GO
|
|
293 |
|
90f7aa
|
294 |
CREATE INDEX [IX_contactgroupmembers_contact_id] ON [dbo].[contactgroupmembers]([contact_id]) ON [PRIMARY]
|
3a5476
|
295 |
GO
|
96f965
|
296 |
|
107bde
|
297 |
ALTER TABLE [dbo].[identities] ADD
|
T |
298 |
CONSTRAINT [DF_identities_user] DEFAULT ('0') FOR [user_id],
|
|
299 |
CONSTRAINT [DF_identities_del] DEFAULT ('0') FOR [del],
|
|
300 |
CONSTRAINT [DF_identities_standard] DEFAULT ('0') FOR [standard],
|
|
301 |
CONSTRAINT [DF_identities_name] DEFAULT ('') FOR [name],
|
|
302 |
CONSTRAINT [DF_identities_organization] DEFAULT ('') FOR [organization],
|
|
303 |
CONSTRAINT [DF_identities_email] DEFAULT ('') FOR [email],
|
|
304 |
CONSTRAINT [DF_identities_reply] DEFAULT ('') FOR [reply-to],
|
|
305 |
CONSTRAINT [DF_identities_bcc] DEFAULT ('') FOR [bcc],
|
7c6bc1
|
306 |
CONSTRAINT [DF_identities_html_signature] DEFAULT ('0') FOR [html_signature],
|
90f7aa
|
307 |
CHECK ([standard] = '1' or [standard] = '0'),
|
AM |
308 |
CHECK ([del] = '1' or [del] = '0')
|
107bde
|
309 |
GO
|
T |
310 |
|
90f7aa
|
311 |
CREATE INDEX [IX_identities_user_id] ON [dbo].[identities]([user_id]) ON [PRIMARY]
|
107bde
|
312 |
GO
|
90f7aa
|
313 |
CREATE INDEX [IX_identities_email] ON [dbo].[identities]([email],[del]) ON [PRIMARY]
|
565c47
|
314 |
GO
|
107bde
|
315 |
|
T |
316 |
ALTER TABLE [dbo].[session] ADD
|
|
317 |
CONSTRAINT [DF_session_sess_id] DEFAULT ('') FOR [sess_id],
|
|
318 |
CONSTRAINT [DF_session_created] DEFAULT (getdate()) FOR [created],
|
|
319 |
CONSTRAINT [DF_session_ip] DEFAULT ('') FOR [ip]
|
|
320 |
GO
|
|
321 |
|
90f7aa
|
322 |
CREATE INDEX [IX_session_changed] ON [dbo].[session]([changed]) ON [PRIMARY]
|
3e48d2
|
323 |
GO
|
A |
324 |
|
107bde
|
325 |
ALTER TABLE [dbo].[users] ADD
|
T |
326 |
CONSTRAINT [DF_users_username] DEFAULT ('') FOR [username],
|
|
327 |
CONSTRAINT [DF_users_mail_host] DEFAULT ('') FOR [mail_host],
|
7c6bc1
|
328 |
CONSTRAINT [DF_users_created] DEFAULT (getdate()) FOR [created]
|
107bde
|
329 |
GO
|
T |
330 |
|
90f7aa
|
331 |
CREATE UNIQUE INDEX [IX_users_username] ON [dbo].[users]([username],[mail_host]) ON [PRIMARY]
|
3cf099
|
332 |
GO
|
A |
333 |
|
90f7aa
|
334 |
CREATE UNIQUE INDEX [IX_dictionary_user_language] ON [dbo].[dictionary]([user_id],[language]) ON [PRIMARY]
|
66df08
|
335 |
GO
|
A |
336 |
|
f8e48d
|
337 |
ALTER TABLE [dbo].[searches] ADD
|
A |
338 |
CONSTRAINT [DF_searches_user] DEFAULT (0) FOR [user_id],
|
ccce87
|
339 |
CONSTRAINT [DF_searches_type] DEFAULT (0) FOR [type]
|
f8e48d
|
340 |
GO
|
A |
341 |
|
|
342 |
CREATE UNIQUE INDEX [IX_searches_user_type_name] ON [dbo].[searches]([user_id],[type],[name]) ON [PRIMARY]
|
|
343 |
GO
|
|
344 |
|
ac1898
|
345 |
ALTER TABLE [dbo].[identities] ADD CONSTRAINT [FK_identities_user_id]
|
A |
346 |
FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
|
3cf099
|
347 |
ON DELETE CASCADE ON UPDATE CASCADE
|
A |
348 |
GO
|
|
349 |
|
ac1898
|
350 |
ALTER TABLE [dbo].[contacts] ADD CONSTRAINT [FK_contacts_user_id]
|
A |
351 |
FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
|
3cf099
|
352 |
ON DELETE CASCADE ON UPDATE CASCADE
|
A |
353 |
GO
|
|
354 |
|
ac1898
|
355 |
ALTER TABLE [dbo].[contactgroups] ADD CONSTRAINT [FK_contactgroups_user_id]
|
A |
356 |
FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
|
3cf099
|
357 |
ON DELETE CASCADE ON UPDATE CASCADE
|
A |
358 |
GO
|
|
359 |
|
ac1898
|
360 |
ALTER TABLE [dbo].[cache] ADD CONSTRAINT [FK_cache_user_id]
|
A |
361 |
FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
|
3cf099
|
362 |
ON DELETE CASCADE ON UPDATE CASCADE
|
A |
363 |
GO
|
|
364 |
|
80152b
|
365 |
ALTER TABLE [dbo].[cache_index] ADD CONSTRAINT [FK_cache_index_user_id]
|
A |
366 |
FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
|
|
367 |
ON DELETE CASCADE ON UPDATE CASCADE
|
|
368 |
GO
|
|
369 |
|
|
370 |
ALTER TABLE [dbo].[cache_thread] ADD CONSTRAINT [FK_cache_thread_user_id]
|
|
371 |
FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
|
|
372 |
ON DELETE CASCADE ON UPDATE CASCADE
|
|
373 |
GO
|
|
374 |
|
|
375 |
ALTER TABLE [dbo].[cache_messages] ADD CONSTRAINT [FK_cache_messages_user_id]
|
ac1898
|
376 |
FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
|
3cf099
|
377 |
ON DELETE CASCADE ON UPDATE CASCADE
|
A |
378 |
GO
|
|
379 |
|
ac1898
|
380 |
ALTER TABLE [dbo].[contactgroupmembers] ADD CONSTRAINT [FK_contactgroupmembers_contactgroup_id]
|
A |
381 |
FOREIGN KEY ([contactgroup_id]) REFERENCES [dbo].[contactgroups] ([contactgroup_id])
|
3cf099
|
382 |
ON DELETE CASCADE ON UPDATE CASCADE
|
A |
383 |
GO
|
|
384 |
|
f8e48d
|
385 |
ALTER TABLE [dbo].[searches] ADD CONSTRAINT [FK_searches_user_id]
|
A |
386 |
FOREIGN KEY ([user_id]) REFERENCES [dbo].[users] ([user_id])
|
|
387 |
ON DELETE CASCADE ON UPDATE CASCADE
|
|
388 |
GO
|
|
389 |
|
871013
|
390 |
-- Use trigger instead of foreign key (#1487112)
|
A |
391 |
-- "Introducing FOREIGN KEY constraint ... may cause cycles or multiple cascade paths."
|
|
392 |
CREATE TRIGGER [contact_delete_member] ON [dbo].[contacts]
|
|
393 |
AFTER DELETE AS
|
|
394 |
DELETE FROM [dbo].[contactgroupmembers]
|
|
395 |
WHERE [contact_id] IN (SELECT [contact_id] FROM deleted)
|
e4d9f0
|
396 |
GO
|
A |
397 |
|
a15d87
|
398 |
INSERT INTO [dbo].[system] ([name], [value]) VALUES ('roundcube-version', '2015111100')
|
b7e7c8
|
399 |
GO
|
AM |
400 |
|