Mercurial > hg > rc2
comparison SQL/postgres/2011092800.sql @ 0:4681f974d28b
vanilla 1.3.3 distro, I hope
author | Charlie Root |
---|---|
date | Thu, 04 Jan 2018 15:52:31 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4681f974d28b |
---|---|
1 -- Updates from version 0.6 | |
2 | |
3 CREATE TABLE dictionary ( | |
4 user_id integer DEFAULT NULL | |
5 REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE, | |
6 "language" varchar(5) NOT NULL, | |
7 data text NOT NULL, | |
8 CONSTRAINT dictionary_user_id_language_key UNIQUE (user_id, "language") | |
9 ); | |
10 | |
11 CREATE SEQUENCE search_ids | |
12 INCREMENT BY 1 | |
13 NO MAXVALUE | |
14 NO MINVALUE | |
15 CACHE 1; | |
16 | |
17 CREATE TABLE searches ( | |
18 search_id integer DEFAULT nextval('search_ids'::text) PRIMARY KEY, | |
19 user_id integer NOT NULL | |
20 REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE, | |
21 "type" smallint DEFAULT 0 NOT NULL, | |
22 name varchar(128) NOT NULL, | |
23 data text NOT NULL, | |
24 CONSTRAINT searches_user_id_key UNIQUE (user_id, "type", name) | |
25 ); | |
26 | |
27 DROP SEQUENCE message_ids; | |
28 DROP TABLE messages; | |
29 | |
30 CREATE TABLE cache_index ( | |
31 user_id integer NOT NULL | |
32 REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE, | |
33 mailbox varchar(255) NOT NULL, | |
34 changed timestamp with time zone DEFAULT now() NOT NULL, | |
35 valid smallint NOT NULL DEFAULT 0, | |
36 data text NOT NULL, | |
37 PRIMARY KEY (user_id, mailbox) | |
38 ); | |
39 | |
40 CREATE INDEX cache_index_changed_idx ON cache_index (changed); | |
41 | |
42 CREATE TABLE cache_thread ( | |
43 user_id integer NOT NULL | |
44 REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE, | |
45 mailbox varchar(255) NOT NULL, | |
46 changed timestamp with time zone DEFAULT now() NOT NULL, | |
47 data text NOT NULL, | |
48 PRIMARY KEY (user_id, mailbox) | |
49 ); | |
50 | |
51 CREATE INDEX cache_thread_changed_idx ON cache_thread (changed); | |
52 | |
53 CREATE TABLE cache_messages ( | |
54 user_id integer NOT NULL | |
55 REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE, | |
56 mailbox varchar(255) NOT NULL, | |
57 uid integer NOT NULL, | |
58 changed timestamp with time zone DEFAULT now() NOT NULL, | |
59 data text NOT NULL, | |
60 flags integer NOT NULL DEFAULT 0, | |
61 PRIMARY KEY (user_id, mailbox, uid) | |
62 ); | |
63 | |
64 CREATE INDEX cache_messages_changed_idx ON cache_messages (changed); |