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