Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 242 lines (186 sloc) 9.18 kb
e019f2d @alecpl - s/RoundCube/Roundcube/
alecpl authored
1 -- Roundcube Webmail update script for MySQL databases
161bb97 @alecpl - Added ALTER TABLE .. ENGINE=InnoDB, per discussion in #1486794
alecpl authored
2
3 -- Updates from version 0.1-stable
79fe17f @thomascube Added SQLite supprt and MySQL update script
thomascube authored
4
29451cf @thomascube Truncate cache table before adding index
thomascube authored
5 TRUNCATE TABLE `messages`;
6
f7bfec9 @thomascube Finalized new message parsing. Attention: changes in database schema
thomascube authored
7 ALTER TABLE `messages`
ac26b96 @thomascube Optimize database schema; get rid of unnecessary indexes
thomascube authored
8 DROP INDEX `idx`,
9 DROP INDEX `uid`;
5870871 @thomascube Changed sql scripts to allow non-ascii chars in user names (#1483959)
thomascube authored
10
ac26b96 @thomascube Optimize database schema; get rid of unnecessary indexes
thomascube authored
11 ALTER TABLE `cache`
12 DROP INDEX `cache_key`,
13 DROP INDEX `session_id`,
14 ADD INDEX `user_cache_index` (`user_id`,`cache_key`);
6cb7786 @alecpl #1484854
alecpl authored
15
16 ALTER TABLE `users`
f5e8d23 @alecpl #1484962: typo
alecpl authored
17 ADD INDEX `username_index` (`username`),
6cb7786 @alecpl #1484854
alecpl authored
18 ADD INDEX `alias_index` (`alias`);
d7f3d79 @alecpl -Fixed Mysql DDL for default identities creation (#1485070)
alecpl authored
19
20 -- Updates from version 0.1.1
21
22 ALTER TABLE `identities`
f18911a @alecpl - #1485120 (text column can't have a default value)
alecpl authored
23 MODIFY `signature` text,
d7f3d79 @alecpl -Fixed Mysql DDL for default identities creation (#1485070)
alecpl authored
24 MODIFY `bcc` varchar(128) NOT NULL DEFAULT '',
25 MODIFY `reply-to` varchar(128) NOT NULL DEFAULT '',
26 MODIFY `organization` varchar(128) NOT NULL DEFAULT '',
27 MODIFY `name` varchar(128) NOT NULL,
28 MODIFY `email` varchar(128) NOT NULL;
c98f3b5 @alecpl #1485125: added index on messages.created
alecpl authored
29
30 -- Updates from version 0.2-alpha
31
32 ALTER TABLE `messages`
33 ADD INDEX `created_index` (`created`);
be7d3b6 @alecpl - Fix 'cache' table cleanup on session destroy (#1485516)
alecpl authored
34
161bb97 @alecpl - Added ALTER TABLE .. ENGINE=InnoDB, per discussion in #1486794
alecpl authored
35 -- Updates from version 0.2-beta (InnoDB required)
be7d3b6 @alecpl - Fix 'cache' table cleanup on session destroy (#1485516)
alecpl authored
36
37 ALTER TABLE `cache`
dcf780a @alecpl - fix r2076: removed cache.session_id column, removed DELETEs from cache...
alecpl authored
38 DROP `session_id`;
161bb97 @alecpl - Added ALTER TABLE .. ENGINE=InnoDB, per discussion in #1486794
alecpl authored
39
3e48d2e @alecpl - Increase speed of session destroy and garbage clean up
alecpl authored
40 ALTER TABLE `session`
41 ADD INDEX `changed_index` (`changed`);
e4d9f05 @alecpl - Added index on cache.created + small fixes in mssql DDL script
alecpl authored
42
43 ALTER TABLE `cache`
44 ADD INDEX `created_index` (`created`);
debdda0 @alecpl #1485420: remove default (and not null) for users.language column in DDL
alecpl authored
45
46 ALTER TABLE `users`
47 CHANGE `language` `language` varchar(5);
3d601d2 @alecpl - added index in messages table
alecpl authored
48
161bb97 @alecpl - Added ALTER TABLE .. ENGINE=InnoDB, per discussion in #1486794
alecpl authored
49 ALTER TABLE `cache` ENGINE=InnoDB;
50 ALTER TABLE `session` ENGINE=InnoDB;
51 ALTER TABLE `messages` ENGINE=InnoDB;
52 ALTER TABLE `users` ENGINE=InnoDB;
53 ALTER TABLE `contacts` ENGINE=InnoDB;
54 ALTER TABLE `identities` ENGINE=InnoDB;
55
3d601d2 @alecpl - added index in messages table
alecpl authored
56 -- Updates from version 0.3-stable
57
f47e2dc @alecpl - move TRUNCATE before CREATE INDEX (#1486362)
alecpl authored
58 TRUNCATE `messages`;
59
3d601d2 @alecpl - added index in messages table
alecpl authored
60 ALTER TABLE `messages`
61 ADD INDEX `index_index` (`user_id`, `cache_key`, `idx`);
7fec6b2 @alecpl - "TRUNCATE messages" is required to remove buggy cache entries
alecpl authored
62
b2b8b19 @vbenincasa - Change MySQL data type to avoid problems with big session vars
vbenincasa authored
63 ALTER TABLE `session`
64 CHANGE `vars` `vars` MEDIUMTEXT NOT NULL;
23b7656 @alecpl - use better index for contacts table
alecpl authored
65
66 ALTER TABLE `contacts`
67 ADD INDEX `user_contacts_index` (`user_id`,`email`);
8248e4a @alecpl - Add workaround for MySQL bug [http://bugs.mysql.com/bug.php?id=46293] ...
alecpl authored
68
69 -- Updates from version 0.3.1
fc55295 @alecpl - Added warning about tables engine, per discussion in #1486794
alecpl authored
70 -- WARNING: Make sure that all tables are using InnoDB engine!!!
71 -- If not, use: ALTER TABLE xxx ENGINE=InnoDB;
8248e4a @alecpl - Add workaround for MySQL bug [http://bugs.mysql.com/bug.php?id=46293] ...
alecpl authored
72
73 /* MySQL bug workaround: http://bugs.mysql.com/bug.php?id=46293 */
5cec0c6 @alecpl - typo
alecpl authored
74 /*!40014 SET FOREIGN_KEY_CHECKS=0 */;
8248e4a @alecpl - Add workaround for MySQL bug [http://bugs.mysql.com/bug.php?id=46293] ...
alecpl authored
75
76 ALTER TABLE `messages` DROP FOREIGN KEY `user_id_fk_messages`;
77 ALTER TABLE `cache` DROP FOREIGN KEY `user_id_fk_cache`;
78 ALTER TABLE `contacts` DROP FOREIGN KEY `user_id_fk_contacts`;
79 ALTER TABLE `identities` DROP FOREIGN KEY `user_id_fk_identities`;
80
81 ALTER TABLE `messages` ADD CONSTRAINT `user_id_fk_messages` FOREIGN KEY (`user_id`)
1aaeaaa @alecpl - fix foreign keys defs unintentionally broken in r3333
alecpl authored
82 REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
8248e4a @alecpl - Add workaround for MySQL bug [http://bugs.mysql.com/bug.php?id=46293] ...
alecpl authored
83 ALTER TABLE `cache` ADD CONSTRAINT `user_id_fk_cache` FOREIGN KEY (`user_id`)
1aaeaaa @alecpl - fix foreign keys defs unintentionally broken in r3333
alecpl authored
84 REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
8248e4a @alecpl - Add workaround for MySQL bug [http://bugs.mysql.com/bug.php?id=46293] ...
alecpl authored
85 ALTER TABLE `contacts` ADD CONSTRAINT `user_id_fk_contacts` FOREIGN KEY (`user_id`)
1aaeaaa @alecpl - fix foreign keys defs unintentionally broken in r3333
alecpl authored
86 REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
8248e4a @alecpl - Add workaround for MySQL bug [http://bugs.mysql.com/bug.php?id=46293] ...
alecpl authored
87 ALTER TABLE `identities` ADD CONSTRAINT `user_id_fk_identities` FOREIGN KEY (`user_id`)
1aaeaaa @alecpl - fix foreign keys defs unintentionally broken in r3333
alecpl authored
88 REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
8248e4a @alecpl - Add workaround for MySQL bug [http://bugs.mysql.com/bug.php?id=46293] ...
alecpl authored
89
951c07b @alecpl - Fix adding contacts SQL error on mysql (#1486459)
alecpl authored
90 ALTER TABLE `contacts` ALTER `name` SET DEFAULT '';
91 ALTER TABLE `contacts` ALTER `firstname` SET DEFAULT '';
92 ALTER TABLE `contacts` ALTER `surname` SET DEFAULT '';
93
ac756e8 @alecpl - fix add index
alecpl authored
94 ALTER TABLE `identities` ADD INDEX `user_identities_index` (`user_id`, `del`);
a35062a @thomascube Always set changed date when marking a DB record as deleted + provide a ...
thomascube authored
95 ALTER TABLE `identities` ADD `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00' AFTER `user_id`;
94fe9ca @alecpl - re-fix (#1486474) + require MySQL 4.0.8 + add index/update in identiti...
alecpl authored
96
a61bbb2 @thomascube Added basic contact groups feature
thomascube authored
97 CREATE TABLE `contactgroups` (
98 `contactgroup_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
99 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
1924136 @alecpl - fix default datetime
alecpl authored
100 `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
a61bbb2 @thomascube Added basic contact groups feature
thomascube authored
101 `del` tinyint(1) NOT NULL DEFAULT '0',
102 `name` varchar(128) NOT NULL DEFAULT '',
103 PRIMARY KEY(`contactgroup_id`),
104 CONSTRAINT `user_id_fk_contactgroups` FOREIGN KEY (`user_id`)
105 REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
106 INDEX `contactgroups_user_index` (`user_id`,`del`)
107 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
108
109 CREATE TABLE `contactgroupmembers` (
110 `contactgroup_id` int(10) UNSIGNED NOT NULL,
111 `contact_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
1924136 @alecpl - fix default datetime
alecpl authored
112 `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
a61bbb2 @thomascube Added basic contact groups feature
thomascube authored
113 PRIMARY KEY (`contactgroup_id`, `contact_id`),
114 CONSTRAINT `contactgroup_id_fk_contactgroups` FOREIGN KEY (`contactgroup_id`)
115 REFERENCES `contactgroups`(`contactgroup_id`) ON DELETE CASCADE ON UPDATE CASCADE,
116 CONSTRAINT `contact_id_fk_contacts` FOREIGN KEY (`contact_id`)
117 REFERENCES `contacts`(`contact_id`) ON DELETE CASCADE ON UPDATE CASCADE
118 ) /*!40000 ENGINE=INNODB */;
119
5cec0c6 @alecpl - typo
alecpl authored
120 /*!40014 SET FOREIGN_KEY_CHECKS=1 */;
e2402ef @alecpl - Set DEFAULT NULL for users.last_login
alecpl authored
121
122 -- Updates from version 0.4-beta
123
124 ALTER TABLE `users` CHANGE `last_login` `last_login` datetime DEFAULT NULL;
125 UPDATE `users` SET `last_login` = NULL WHERE `last_login` = '1000-01-01 00:00:00';
ace511a @alecpl - Add unique index on users.username+users.mail_host
alecpl authored
126
127 -- Updates from version 0.4.2
128
129 ALTER TABLE `users` DROP INDEX `username_index`;
130 ALTER TABLE `users` ADD UNIQUE `username` (`username`, `mail_host`);
131
6f09681 @alecpl - Support contact's email addresses up to 255 characters long (#1487095)
alecpl authored
132 ALTER TABLE `contacts` MODIFY `email` varchar(255) NOT NULL;
133
cdb8b96 @thomascube Clear message cache table when upgrading
thomascube authored
134 TRUNCATE TABLE `messages`;
135
faf10e8 @thomascube Fix automatic db updates; trigger contact indexing after upgrade
thomascube authored
136 -- Updates from version 0.5.1
137 -- Updates from version 0.5.2
138 -- Updates from version 0.5.3
139 -- Updates from version 0.5.4
3e26373 @thomascube Fulltext search over contact fields. Attention: DATABASE SCHEMA CHANGED\...
thomascube authored
140
141 ALTER TABLE `contacts` ADD `words` TEXT NULL AFTER `vcard`;
09b0e36 @thomascube Change vcard field to LONGTEXT to completely store vcards with embedded ...
thomascube authored
142 ALTER TABLE `contacts` CHANGE `vcard` `vcard` LONGTEXT /*!40101 CHARACTER SET utf8 */ NULL DEFAULT NULL;
3a5476d @alecpl - Add index on contactgroupmembers.contact_id column.
alecpl authored
143 ALTER TABLE `contactgroupmembers` ADD INDEX `contactgroupmembers_contact_index` (`contact_id`);
d08333e @alecpl - Fix problems with subfolders of INBOX folder on some IMAP servers (#14...
alecpl authored
144
145 TRUNCATE TABLE `messages`;
146 TRUNCATE TABLE `cache`;
66df084 @alecpl - Merge devel-spellcheck branch:
alecpl authored
147
502436d @thomascube We're on the road towards 0.7 now
thomascube authored
148 -- Updates from version 0.6
66df084 @alecpl - Merge devel-spellcheck branch:
alecpl authored
149
d2d94ac @alecpl - Disable FOREIGN_KEY_CHECKS in update from 0.6 (#1488209)
alecpl authored
150 /*!40014 SET FOREIGN_KEY_CHECKS=0 */;
151
d5ae977 @alecpl - Fix username case-insensitivity issue in MySQL (#1488021)
alecpl authored
152 ALTER TABLE `users` CHANGE `alias` `alias` varchar(128) BINARY NOT NULL;
153 ALTER TABLE `users` CHANGE `username` `username` varchar(128) BINARY NOT NULL;
154
66df084 @alecpl - Merge devel-spellcheck branch:
alecpl authored
155 CREATE TABLE `dictionary` (
156 `user_id` int(10) UNSIGNED DEFAULT NULL,
157 `language` varchar(5) NOT NULL,
158 `data` longtext NOT NULL,
159 CONSTRAINT `user_id_fk_dictionary` FOREIGN KEY (`user_id`)
160 REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
161 UNIQUE `uniqueness` (`user_id`, `language`)
162 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
f8e48df @alecpl - Merge devel-saved_search branch (Addressbook Saved Searches)
alecpl authored
163
164 CREATE TABLE `searches` (
165 `search_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
166 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
167 `type` int(3) NOT NULL DEFAULT '0',
168 `name` varchar(128) NOT NULL,
169 `data` text,
170 PRIMARY KEY(`search_id`),
171 CONSTRAINT `user_id_fk_searches` FOREIGN KEY (`user_id`)
172 REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
173 UNIQUE `uniqueness` (`user_id`, `type`, `name`)
174 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
80152b3 @alecpl - Rewritten messages caching (merged devel-mcache branch):
alecpl authored
175
176 DROP TABLE `messages`;
177
178 CREATE TABLE `cache_index` (
179 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
180 `mailbox` varchar(255) BINARY NOT NULL,
181 `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
7b2bf71 @alecpl - Add lost cache_index.valid column definition
alecpl authored
182 `valid` tinyint(1) NOT NULL DEFAULT '0',
80152b3 @alecpl - Rewritten messages caching (merged devel-mcache branch):
alecpl authored
183 `data` longtext NOT NULL,
184 CONSTRAINT `user_id_fk_cache_index` FOREIGN KEY (`user_id`)
185 REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
186 INDEX `changed_index` (`changed`),
187 PRIMARY KEY (`user_id`, `mailbox`)
188 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
189
190 CREATE TABLE `cache_thread` (
191 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
192 `mailbox` varchar(255) BINARY NOT NULL,
193 `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
194 `data` longtext NOT NULL,
195 CONSTRAINT `user_id_fk_cache_thread` FOREIGN KEY (`user_id`)
196 REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
197 INDEX `changed_index` (`changed`),
198 PRIMARY KEY (`user_id`, `mailbox`)
199 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
200
201 CREATE TABLE `cache_messages` (
202 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
203 `mailbox` varchar(255) BINARY NOT NULL,
204 `uid` int(11) UNSIGNED NOT NULL DEFAULT '0',
205 `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
206 `data` longtext NOT NULL,
609d392 @alecpl - Cache synchronization using QRESYNC/CONDSTORE
alecpl authored
207 `flags` int(11) NOT NULL DEFAULT '0',
80152b3 @alecpl - Rewritten messages caching (merged devel-mcache branch):
alecpl authored
208 CONSTRAINT `user_id_fk_cache_messages` FOREIGN KEY (`user_id`)
209 REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
210 INDEX `changed_index` (`changed`),
211 PRIMARY KEY (`user_id`, `mailbox`, `uid`)
212 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
b8ae0ec @alecpl - Fixed bug where session ID's length was limited to 40 characters. Sinc...
alecpl authored
213
d2d94ac @alecpl - Disable FOREIGN_KEY_CHECKS in update from 0.6 (#1488209)
alecpl authored
214 /*!40014 SET FOREIGN_KEY_CHECKS=1 */;
215
f450743 @alecpl - Add version markers
alecpl authored
216 -- Updates from version 0.7-beta
217
b8ae0ec @alecpl - Fixed bug where session ID's length was limited to 40 characters. Sinc...
alecpl authored
218 ALTER TABLE `session` CHANGE `sess_id` `sess_id` varchar(128) NOT NULL;
48be8f6 @alecpl - Fix SQL Error when saving a contact with many email addresses (#148828...
alecpl authored
219
220 -- Updates from version 0.7
221
323f15b @alecpl - Disable FOREIGN_KEY_CHECKS for update from 0.7
alecpl authored
222 /*!40014 SET FOREIGN_KEY_CHECKS=0 */;
223
48be8f6 @alecpl - Fix SQL Error when saving a contact with many email addresses (#148828...
alecpl authored
224 ALTER TABLE `contacts` DROP FOREIGN KEY `user_id_fk_contacts`;
225 ALTER TABLE `contacts` DROP INDEX `user_contacts_index`;
226 ALTER TABLE `contacts` MODIFY `email` text NOT NULL DEFAULT '';
227 ALTER TABLE `contacts` ADD INDEX `user_contacts_index` (`user_id`,`del`);
228 ALTER TABLE `contacts` ADD CONSTRAINT `user_id_fk_contacts` FOREIGN KEY (`user_id`)
229 REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
230
231 ALTER TABLE `cache` ALTER `user_id` DROP DEFAULT;
232 ALTER TABLE `cache_index` ALTER `user_id` DROP DEFAULT;
233 ALTER TABLE `cache_thread` ALTER `user_id` DROP DEFAULT;
234 ALTER TABLE `cache_messages` ALTER `user_id` DROP DEFAULT;
235 ALTER TABLE `contacts` ALTER `user_id` DROP DEFAULT;
236 ALTER TABLE `contactgroups` ALTER `user_id` DROP DEFAULT;
237 ALTER TABLE `contactgroupmembers` ALTER `contact_id` DROP DEFAULT;
238 ALTER TABLE `identities` ALTER `user_id` DROP DEFAULT;
239 ALTER TABLE `searches` ALTER `user_id` DROP DEFAULT;
323f15b @alecpl - Disable FOREIGN_KEY_CHECKS for update from 0.7
alecpl authored
240
241 /*!40014 SET FOREIGN_KEY_CHECKS=1 */;
Something went wrong with that request. Please try again.