annotate SQL/postgres.initial.sql @ 0:1e000243b222

vanilla 1.3.3 distro, I hope
author Charlie Root
date Thu, 04 Jan 2018 15:50:29 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
1 -- Roundcube Webmail initial database structure
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
2
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
3 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
4 -- Sequence "users_seq"
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
5 -- Name: users_seq; Type: SEQUENCE; Schema: public; Owner: postgres
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
6 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
7
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
8 CREATE SEQUENCE users_seq
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
9 INCREMENT BY 1
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
10 NO MAXVALUE
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
11 NO MINVALUE
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
12 CACHE 1;
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
13
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
14 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
15 -- Table "users"
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
16 -- Name: users; Type: TABLE; Schema: public; Owner: postgres
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
17 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
18
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
19 CREATE TABLE users (
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
20 user_id integer DEFAULT nextval('users_seq'::text) PRIMARY KEY,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
21 username varchar(128) DEFAULT '' NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
22 mail_host varchar(128) DEFAULT '' NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
23 created timestamp with time zone DEFAULT now() NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
24 last_login timestamp with time zone DEFAULT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
25 failed_login timestamp with time zone DEFAULT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
26 failed_login_counter integer DEFAULT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
27 "language" varchar(5),
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
28 preferences text DEFAULT ''::text NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
29 CONSTRAINT users_username_key UNIQUE (username, mail_host)
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
30 );
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
31
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
32
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
33 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
34 -- Table "session"
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
35 -- Name: session; Type: TABLE; Schema: public; Owner: postgres
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
36 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
37
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
38 CREATE TABLE "session" (
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
39 sess_id varchar(128) DEFAULT '' PRIMARY KEY,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
40 changed timestamp with time zone DEFAULT now() NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
41 ip varchar(41) NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
42 vars text NOT NULL
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
43 );
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
44
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
45 CREATE INDEX session_changed_idx ON session (changed);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
46
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
47
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
48 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
49 -- Sequence "identities_seq"
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
50 -- Name: identities_seq; Type: SEQUENCE; Schema: public; Owner: postgres
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
51 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
52
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
53 CREATE SEQUENCE identities_seq
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
54 START WITH 1
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
55 INCREMENT BY 1
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
56 NO MAXVALUE
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
57 NO MINVALUE
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
58 CACHE 1;
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
59
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
60 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
61 -- Table "identities"
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
62 -- Name: identities; Type: TABLE; Schema: public; Owner: postgres
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
63 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
64
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
65 CREATE TABLE identities (
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
66 identity_id integer DEFAULT nextval('identities_seq'::text) PRIMARY KEY,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
67 user_id integer NOT NULL
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
68 REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
69 changed timestamp with time zone DEFAULT now() NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
70 del smallint DEFAULT 0 NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
71 standard smallint DEFAULT 0 NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
72 name varchar(128) NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
73 organization varchar(128),
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
74 email varchar(128) NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
75 "reply-to" varchar(128),
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
76 bcc varchar(128),
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
77 signature text,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
78 html_signature integer DEFAULT 0 NOT NULL
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
79 );
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
80
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
81 CREATE INDEX identities_user_id_idx ON identities (user_id, del);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
82 CREATE INDEX identities_email_idx ON identities (email, del);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
83
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
84
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
85 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
86 -- Sequence "contacts_seq"
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
87 -- Name: contacts_seq; Type: SEQUENCE; Schema: public; Owner: postgres
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
88 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
89
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
90 CREATE SEQUENCE contacts_seq
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
91 START WITH 1
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
92 INCREMENT BY 1
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
93 NO MAXVALUE
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
94 NO MINVALUE
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
95 CACHE 1;
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
96
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
97 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
98 -- Table "contacts"
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
99 -- Name: contacts; Type: TABLE; Schema: public; Owner: postgres
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
100 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
101
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
102 CREATE TABLE contacts (
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
103 contact_id integer DEFAULT nextval('contacts_seq'::text) PRIMARY KEY,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
104 user_id integer NOT NULL
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
105 REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
106 changed timestamp with time zone DEFAULT now() NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
107 del smallint DEFAULT 0 NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
108 name varchar(128) DEFAULT '' NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
109 email text DEFAULT '' NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
110 firstname varchar(128) DEFAULT '' NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
111 surname varchar(128) DEFAULT '' NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
112 vcard text,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
113 words text
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
114 );
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
115
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
116 CREATE INDEX contacts_user_id_idx ON contacts (user_id, del);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
117
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
118 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
119 -- Sequence "contactgroups_seq"
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
120 -- Name: contactgroups_seq; Type: SEQUENCE; Schema: public; Owner: postgres
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
121 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
122
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
123 CREATE SEQUENCE contactgroups_seq
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
124 INCREMENT BY 1
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
125 NO MAXVALUE
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
126 NO MINVALUE
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
127 CACHE 1;
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
128
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
129 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
130 -- Table "contactgroups"
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
131 -- Name: contactgroups; Type: TABLE; Schema: public; Owner: postgres
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
132 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
133
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
134 CREATE TABLE contactgroups (
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
135 contactgroup_id integer DEFAULT nextval('contactgroups_seq'::text) PRIMARY KEY,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
136 user_id integer NOT NULL
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
137 REFERENCES users(user_id) ON DELETE CASCADE ON UPDATE CASCADE,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
138 changed timestamp with time zone DEFAULT now() NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
139 del smallint NOT NULL DEFAULT 0,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
140 name varchar(128) NOT NULL DEFAULT ''
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
141 );
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
142
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
143 CREATE INDEX contactgroups_user_id_idx ON contactgroups (user_id, del);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
144
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
145 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
146 -- Table "contactgroupmembers"
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
147 -- Name: contactgroupmembers; Type: TABLE; Schema: public; Owner: postgres
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
148 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
149
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
150 CREATE TABLE contactgroupmembers (
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
151 contactgroup_id integer NOT NULL
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
152 REFERENCES contactgroups(contactgroup_id) ON DELETE CASCADE ON UPDATE CASCADE,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
153 contact_id integer NOT NULL
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
154 REFERENCES contacts(contact_id) ON DELETE CASCADE ON UPDATE CASCADE,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
155 created timestamp with time zone DEFAULT now() NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
156 PRIMARY KEY (contactgroup_id, contact_id)
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
157 );
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
158
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
159 CREATE INDEX contactgroupmembers_contact_id_idx ON contactgroupmembers (contact_id);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
160
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
161 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
162 -- Table "cache"
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
163 -- Name: cache; Type: TABLE; Schema: public; Owner: postgres
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
164 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
165
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
166 CREATE TABLE "cache" (
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
167 user_id integer NOT NULL
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
168 REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
169 cache_key varchar(128) DEFAULT '' NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
170 expires timestamp with time zone DEFAULT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
171 data text NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
172 PRIMARY KEY (user_id, cache_key)
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
173 );
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
174
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
175 CREATE INDEX cache_expires_idx ON "cache" (expires);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
176
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
177 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
178 -- Table "cache_shared"
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
179 -- Name: cache_shared; Type: TABLE; Schema: public; Owner: postgres
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
180 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
181
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
182 CREATE TABLE "cache_shared" (
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
183 cache_key varchar(255) NOT NULL PRIMARY KEY,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
184 expires timestamp with time zone DEFAULT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
185 data text NOT NULL
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
186 );
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
187
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
188 CREATE INDEX cache_shared_expires_idx ON "cache_shared" (expires);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
189
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
190 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
191 -- Table "cache_index"
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
192 -- Name: cache_index; Type: TABLE; Schema: public; Owner: postgres
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
193 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
194
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
195 CREATE TABLE cache_index (
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
196 user_id integer NOT NULL
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
197 REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
198 mailbox varchar(255) NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
199 expires timestamp with time zone DEFAULT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
200 valid smallint NOT NULL DEFAULT 0,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
201 data text NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
202 PRIMARY KEY (user_id, mailbox)
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
203 );
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
204
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
205 CREATE INDEX cache_index_expires_idx ON cache_index (expires);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
206
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
207 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
208 -- Table "cache_thread"
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
209 -- Name: cache_thread; Type: TABLE; Schema: public; Owner: postgres
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
210 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
211
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
212 CREATE TABLE cache_thread (
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
213 user_id integer NOT NULL
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
214 REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
215 mailbox varchar(255) NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
216 expires timestamp with time zone DEFAULT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
217 data text NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
218 PRIMARY KEY (user_id, mailbox)
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
219 );
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
220
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
221 CREATE INDEX cache_thread_expires_idx ON cache_thread (expires);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
222
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
223 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
224 -- Table "cache_messages"
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
225 -- Name: cache_messages; Type: TABLE; Schema: public; Owner: postgres
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
226 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
227
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
228 CREATE TABLE cache_messages (
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
229 user_id integer NOT NULL
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
230 REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
231 mailbox varchar(255) NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
232 uid integer NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
233 expires timestamp with time zone DEFAULT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
234 data text NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
235 flags integer NOT NULL DEFAULT 0,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
236 PRIMARY KEY (user_id, mailbox, uid)
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
237 );
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
238
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
239 CREATE INDEX cache_messages_expires_idx ON cache_messages (expires);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
240
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
241 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
242 -- Table "dictionary"
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
243 -- Name: dictionary; Type: TABLE; Schema: public; Owner: postgres
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
244 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
245
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
246 CREATE TABLE dictionary (
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
247 user_id integer DEFAULT NULL
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
248 REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
249 "language" varchar(5) NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
250 data text NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
251 CONSTRAINT dictionary_user_id_language_key UNIQUE (user_id, "language")
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
252 );
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
253
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
254 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
255 -- Sequence "searches_seq"
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
256 -- Name: searches_seq; Type: SEQUENCE; Schema: public; Owner: postgres
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
257 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
258
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
259 CREATE SEQUENCE searches_seq
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
260 INCREMENT BY 1
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
261 NO MAXVALUE
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
262 NO MINVALUE
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
263 CACHE 1;
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
264
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
265 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
266 -- Table "searches"
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
267 -- Name: searches; Type: TABLE; Schema: public; Owner: postgres
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
268 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
269
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
270 CREATE TABLE searches (
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
271 search_id integer DEFAULT nextval('searches_seq'::text) PRIMARY KEY,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
272 user_id integer NOT NULL
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
273 REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
274 "type" smallint DEFAULT 0 NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
275 name varchar(128) NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
276 data text NOT NULL,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
277 CONSTRAINT searches_user_id_key UNIQUE (user_id, "type", name)
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
278 );
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
279
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
280
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
281 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
282 -- Table "system"
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
283 -- Name: system; Type: TABLE; Schema: public; Owner: postgres
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
284 --
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
285
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
286 CREATE TABLE "system" (
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
287 name varchar(64) NOT NULL PRIMARY KEY,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
288 value text
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
289 );
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
290
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
291 INSERT INTO system (name, value) VALUES ('roundcube-version', '2016112200');