annotate SQL/mssql.initial.sql @ 0:4681f974d28b

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