Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 186 lines (140 sloc) 6.09 kB
e019f2d @alecpl - s/RoundCube/Roundcube/
alecpl authored
1 -- Roundcube Webmail update script for Postgres databases
ac26b96 @thomascube Optimize database schema; get rid of unnecessary indexes
thomascube authored
2 -- Updates from version 0.1-stable to 0.1.1
a0109c4 Initial TinyMCE editor support (still need to work on spellcheck and …
svncommit authored
3
6cb7786 @alecpl #1484854
alecpl authored
4 CREATE INDEX cache_user_id_idx ON cache (user_id, cache_key);
5 CREATE INDEX contacts_user_id_idx ON contacts (user_id);
6 CREATE INDEX identities_user_id_idx ON identities (user_id);
7
8 CREATE INDEX users_username_id_idx ON users (username);
9 CREATE INDEX users_alias_id_idx ON users (alias);
10
11 -- added ON DELETE/UPDATE actions
12 ALTER TABLE messages DROP CONSTRAINT messages_user_id_fkey;
13 ALTER TABLE messages ADD FOREIGN KEY (user_id) REFERENCES users(user_id) ON DELETE CASCADE ON UPDATE CASCADE;
14 ALTER TABLE identities DROP CONSTRAINT identities_user_id_fkey;
15 ALTER TABLE identities ADD FOREIGN KEY (user_id) REFERENCES users(user_id) ON DELETE CASCADE ON UPDATE CASCADE;
16 ALTER TABLE contacts DROP CONSTRAINT contacts_user_id_fkey;
17 ALTER TABLE contacts ADD FOREIGN KEY (user_id) REFERENCES users(user_id) ON DELETE CASCADE ON UPDATE CASCADE;
18 ALTER TABLE cache DROP CONSTRAINT cache_user_id_fkey;
19 ALTER TABLE cache ADD FOREIGN KEY (user_id) REFERENCES users(user_id) ON DELETE CASCADE ON UPDATE CASCADE;
c98f3b5 @alecpl #1485125: added index on messages.created
alecpl authored
20
21 -- Updates from version 0.2-alpha
22
23 CREATE INDEX messages_created_idx ON messages (created);
be7d3b6 @alecpl - Fix 'cache' table cleanup on session destroy (#1485516)
alecpl authored
24
25 -- Updates from version 0.2-beta
26
dcf780a @alecpl - fix r2076: removed cache.session_id column, removed DELETEs from ca…
alecpl authored
27 ALTER TABLE cache DROP session_id;
3e48d2e @alecpl - Increase speed of session destroy and garbage clean up
alecpl authored
28
29 CREATE INDEX session_changed_idx ON session (changed);
e4d9f05 @alecpl - Added index on cache.created + small fixes in mssql DDL script
alecpl authored
30 CREATE INDEX cache_created_idx ON "cache" (created);
debdda0 @alecpl #1485420: remove default (and not null) for users.language column in DDL
alecpl authored
31
32 ALTER TABLE users ALTER "language" DROP NOT NULL;
33 ALTER TABLE users ALTER "language" DROP DEFAULT;
a493ea8 @alecpl - change few "boolean" columns type from integer to smallint
alecpl authored
34
35 ALTER TABLE identities ALTER del TYPE smallint;
36 ALTER TABLE identities ALTER standard TYPE smallint;
37 ALTER TABLE contacts ALTER del TYPE smallint;
38 ALTER TABLE messages ALTER del TYPE smallint;
3d601d2 @alecpl - added index in messages table
alecpl authored
39
40 -- Updates from version 0.3-stable
41
7fec6b2 @alecpl - "TRUNCATE messages" is required to remove buggy cache entries
alecpl authored
42 TRUNCATE messages;
f47e2dc @alecpl - move TRUNCATE before CREATE INDEX (#1486362)
alecpl authored
43 CREATE INDEX messages_index_idx ON messages (user_id, cache_key, idx);
23b7656 @alecpl - use better index for contacts table
alecpl authored
44 DROP INDEX contacts_user_id_idx;
45 CREATE INDEX contacts_user_id_idx ON contacts (user_id, email);
94fe9ca @alecpl - re-fix (#1486474) + require MySQL 4.0.8 + add index/update in ident…
alecpl authored
46
47 -- Updates from version 0.3.1
48
49 DROP INDEX identities_user_id_idx;
50 CREATE INDEX identities_user_id_idx ON identities (user_id, del);
22d6b53 @alecpl - contactgroups DDL for postgres
alecpl authored
51
8a79f22 @alecpl - Fix: postgres doens't support AFTER clause
alecpl authored
52 ALTER TABLE identities ADD changed timestamp with time zone DEFAULT now() NOT NULL;
a35062a @thomascube Always set changed date when marking a DB record as deleted + provide…
thomascube authored
53
22d6b53 @alecpl - contactgroups DDL for postgres
alecpl authored
54 CREATE SEQUENCE contactgroups_ids
55 INCREMENT BY 1
56 NO MAXVALUE
57 NO MINVALUE
58 CACHE 1;
ace511a @alecpl - Add unique index on users.username+users.mail_host
alecpl authored
59
22d6b53 @alecpl - contactgroups DDL for postgres
alecpl authored
60 CREATE TABLE contactgroups (
61 contactgroup_id integer DEFAULT nextval('contactgroups_ids'::text) PRIMARY KEY,
62 user_id integer NOT NULL
63 REFERENCES users(user_id) ON DELETE CASCADE ON UPDATE CASCADE,
64 changed timestamp with time zone DEFAULT now() NOT NULL,
65 del smallint NOT NULL DEFAULT 0,
66 name varchar(128) NOT NULL DEFAULT ''
67 );
68
69 CREATE INDEX contactgroups_user_id_idx ON contactgroups (user_id, del);
70
71 CREATE TABLE contactgroupmembers (
72 contactgroup_id integer NOT NULL
73 REFERENCES contactgroups(contactgroup_id) ON DELETE CASCADE ON UPDATE CASCADE,
74 contact_id integer NOT NULL
75 REFERENCES contacts(contact_id) ON DELETE CASCADE ON UPDATE CASCADE,
76 created timestamp with time zone DEFAULT now() NOT NULL,
77 PRIMARY KEY (contactgroup_id, contact_id)
78 );
e2402ef @alecpl - Set DEFAULT NULL for users.last_login
alecpl authored
79
80 -- Updates from version 0.4-beta
81
82 ALTER TABLE users ALTER last_login DROP NOT NULL;
83 ALTER TABLE users ALTER last_login SET DEFAULT NULL;
ace511a @alecpl - Add unique index on users.username+users.mail_host
alecpl authored
84
85 -- Updates from version 0.4.2
86
87 DROP INDEX users_username_id_idx;
8381ec1 @alecpl - Force names of unique constraints in PostgreSQL DDL (postgres 9.x u…
alecpl authored
88 ALTER TABLE users ADD CONSTRAINT users_username_key UNIQUE (username, mail_host);
6f09681 @alecpl - Support contact's email addresses up to 255 characters long (#1487095)
alecpl authored
89 ALTER TABLE contacts ALTER email TYPE varchar(255);
ace511a @alecpl - Add unique index on users.username+users.mail_host
alecpl authored
90
cdb8b96 @thomascube Clear message cache table when upgrading
thomascube authored
91 TRUNCATE messages;
3e26373 @thomascube Fulltext search over contact fields. Attention: DATABASE SCHEMA CHANG…
thomascube authored
92
faf10e8 @thomascube Fix automatic db updates; trigger contact indexing after upgrade
thomascube authored
93 -- Updates from version 0.5.1
94 -- Updates from version 0.5.2
95 -- Updates from version 0.5.3
96 -- Updates from version 0.5.4
3e26373 @thomascube Fulltext search over contact fields. Attention: DATABASE SCHEMA CHANG…
thomascube authored
97
98 ALTER TABLE contacts ADD words TEXT NULL;
3a5476d @alecpl - Add index on contactgroupmembers.contact_id column.
alecpl authored
99 CREATE INDEX contactgroupmembers_contact_id_idx ON contactgroupmembers (contact_id);
d08333e @alecpl - Fix problems with subfolders of INBOX folder on some IMAP servers (…
alecpl authored
100
101 TRUNCATE messages;
102 TRUNCATE cache;
66df084 @alecpl - Merge devel-spellcheck branch:
alecpl authored
103
502436d @thomascube We're on the road towards 0.7 now
thomascube authored
104 -- Updates from version 0.6
66df084 @alecpl - Merge devel-spellcheck branch:
alecpl authored
105
106 CREATE TABLE dictionary (
107 user_id integer DEFAULT NULL
108 REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,
109 "language" varchar(5) NOT NULL,
110 data text NOT NULL,
111 CONSTRAINT dictionary_user_id_language_key UNIQUE (user_id, "language")
112 );
f8e48df @alecpl - Merge devel-saved_search branch (Addressbook Saved Searches)
alecpl authored
113
114 CREATE SEQUENCE search_ids
115 INCREMENT BY 1
116 NO MAXVALUE
117 NO MINVALUE
118 CACHE 1;
119
120 CREATE TABLE searches (
121 search_id integer DEFAULT nextval('search_ids'::text) PRIMARY KEY,
122 user_id integer NOT NULL
123 REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,
124 "type" smallint DEFAULT 0 NOT NULL,
125 name varchar(128) NOT NULL,
126 data text NOT NULL,
127 CONSTRAINT searches_user_id_key UNIQUE (user_id, "type", name)
128 );
80152b3 @alecpl - Rewritten messages caching (merged devel-mcache branch):
alecpl authored
129
5f481d1 @alecpl - Fix wrong postgres sequence name in upgrade from 0.6
alecpl authored
130 DROP SEQUENCE message_ids;
80152b3 @alecpl - Rewritten messages caching (merged devel-mcache branch):
alecpl authored
131 DROP TABLE messages;
132
133 CREATE TABLE cache_index (
134 user_id integer NOT NULL
135 REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,
136 mailbox varchar(255) NOT NULL,
137 changed timestamp with time zone DEFAULT now() NOT NULL,
7b2bf71 @alecpl - Add lost cache_index.valid column definition
alecpl authored
138 valid smallint NOT NULL DEFAULT 0,
80152b3 @alecpl - Rewritten messages caching (merged devel-mcache branch):
alecpl authored
139 data text NOT NULL,
140 PRIMARY KEY (user_id, mailbox)
141 );
142
143 CREATE INDEX cache_index_changed_idx ON cache_index (changed);
144
145 CREATE TABLE cache_thread (
146 user_id integer NOT NULL
147 REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,
148 mailbox varchar(255) NOT NULL,
149 changed timestamp with time zone DEFAULT now() NOT NULL,
150 data text NOT NULL,
151 PRIMARY KEY (user_id, mailbox)
152 );
153
154 CREATE INDEX cache_thread_changed_idx ON cache_thread (changed);
155
156 CREATE TABLE cache_messages (
157 user_id integer NOT NULL
158 REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,
159 mailbox varchar(255) NOT NULL,
160 uid integer NOT NULL,
161 changed timestamp with time zone DEFAULT now() NOT NULL,
162 data text NOT NULL,
609d392 @alecpl - Cache synchronization using QRESYNC/CONDSTORE
alecpl authored
163 flags integer NOT NULL DEFAULT 0,
80152b3 @alecpl - Rewritten messages caching (merged devel-mcache branch):
alecpl authored
164 PRIMARY KEY (user_id, mailbox, uid)
165 );
166
167 CREATE INDEX cache_messages_changed_idx ON cache_messages (changed);
b8ae0ec @alecpl - Fixed bug where session ID's length was limited to 40 characters. S…
alecpl authored
168
f450743 @alecpl - Add version markers
alecpl authored
169 -- Updates from version 0.7-beta
170
b8ae0ec @alecpl - Fixed bug where session ID's length was limited to 40 characters. S…
alecpl authored
171 ALTER TABLE "session" ALTER sess_id TYPE varchar(128);
48be8f6 @alecpl - Fix SQL Error when saving a contact with many email addresses (#148…
alecpl authored
172
173 -- Updates from version 0.7
174
175 DROP INDEX contacts_user_id_idx;
176 CREATE INDEX contacts_user_id_idx ON contacts USING btree (user_id, del);
177 ALTER TABLE contacts ALTER email TYPE text;
83121ec @alecpl - Removed redundant cache.cache_id column (#1488528)
alecpl authored
178
179 -- Updates from version 0.8
180
181 ALTER TABLE cache DROP COLUMN cache_id;
182 DROP SEQUENCE cache_ids;
565c472 @alecpl Removed users.alias column, added option ('user_aliases')
alecpl authored
183
184 ALTER TABLE users DROP COLUMN alias;
185 CREATE INDEX identities_email_idx ON identities (email, del);
Something went wrong with that request. Please try again.