Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 238 lines (184 sloc) 9.091 kb
e019f2d Aleksander Machniak - s/RoundCube/Roundcube/
alecpl authored
1 -- Roundcube Webmail update script for MySQL databases
161bb97 Aleksander Machniak - Added ALTER TABLE .. ENGINE=InnoDB, per discussion in #1486794
alecpl authored
2
3 -- Updates from version 0.1-stable
79fe17f Thomas B. Added SQLite supprt and MySQL update script
thomascube authored
4
29451cf Thomas B. Truncate cache table before adding index
thomascube authored
5 TRUNCATE TABLE `messages`;
6
f7bfec9 Thomas B. Finalized new message parsing. Attention: changes in database schema
thomascube authored
7 ALTER TABLE `messages`
ac26b96 Thomas B. Optimize database schema; get rid of unnecessary indexes
thomascube authored
8 DROP INDEX `idx`,
9 DROP INDEX `uid`;
5870871 Thomas B. Changed sql scripts to allow non-ascii chars in user names (#1483959)
thomascube authored
10
ac26b96 Thomas B. 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 Aleksander Machniak #1484854
alecpl authored
15
16 ALTER TABLE `users`
f5e8d23 Aleksander Machniak #1484962: typo
alecpl authored
17 ADD INDEX `username_index` (`username`),
6cb7786 Aleksander Machniak #1484854
alecpl authored
18 ADD INDEX `alias_index` (`alias`);
d7f3d79 Aleksander Machniak -Fixed Mysql DDL for default identities creation (#1485070)
alecpl authored
19
20 -- Updates from version 0.1.1
21
22 ALTER TABLE `identities`
f18911a Aleksander Machniak - #1485120 (text column can't have a default value)
alecpl authored
23 MODIFY `signature` text,
d7f3d79 Aleksander Machniak -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 Aleksander Machniak #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 Aleksander Machniak - Fix 'cache' table cleanup on session destroy (#1485516)
alecpl authored
34
161bb97 Aleksander Machniak - Added ALTER TABLE .. ENGINE=InnoDB, per discussion in #1486794
alecpl authored
35 -- Updates from version 0.2-beta (InnoDB required)
be7d3b6 Aleksander Machniak - Fix 'cache' table cleanup on session destroy (#1485516)
alecpl authored
36
37 ALTER TABLE `cache`
dcf780a Aleksander Machniak - fix r2076: removed cache.session_id column, removed DELETEs from cache...
alecpl authored
38 DROP `session_id`;
161bb97 Aleksander Machniak - Added ALTER TABLE .. ENGINE=InnoDB, per discussion in #1486794
alecpl authored
39
3e48d2e Aleksander Machniak - Increase speed of session destroy and garbage clean up
alecpl authored
40 ALTER TABLE `session`
41 ADD INDEX `changed_index` (`changed`);
e4d9f05 Aleksander Machniak - 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 Aleksander Machniak #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 Aleksander Machniak - added index in messages table
alecpl authored
48
161bb97 Aleksander Machniak - 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 Aleksander Machniak - added index in messages table
alecpl authored
56 -- Updates from version 0.3-stable
57
f47e2dc Aleksander Machniak - move TRUNCATE before CREATE INDEX (#1486362)
alecpl authored
58 TRUNCATE `messages`;
59
3d601d2 Aleksander Machniak - added index in messages table
alecpl authored
60 ALTER TABLE `messages`
61 ADD INDEX `index_index` (`user_id`, `cache_key`, `idx`);
7fec6b2 Aleksander Machniak - "TRUNCATE messages" is required to remove buggy cache entries
alecpl authored
62
b2b8b19 Victor Benincasa - 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 Aleksander Machniak - use better index for contacts table
alecpl authored
65
66 ALTER TABLE `contacts`
67 ADD INDEX `user_contacts_index` (`user_id`,`email`);
8248e4a Aleksander Machniak - Add workaround for MySQL bug [http://bugs.mysql.com/bug.php?id=46293] ...
alecpl authored
68
69 -- Updates from version 0.3.1
fc55295 Aleksander Machniak - 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 Aleksander Machniak - 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 Aleksander Machniak - typo
alecpl authored
74 /*!40014 SET FOREIGN_KEY_CHECKS=0 */;
8248e4a Aleksander Machniak - 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 Aleksander Machniak - fix foreign keys defs unintentionally broken in r3333
alecpl authored
82 REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
8248e4a Aleksander Machniak - 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 Aleksander Machniak - fix foreign keys defs unintentionally broken in r3333
alecpl authored
84 REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
8248e4a Aleksander Machniak - 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 Aleksander Machniak - fix foreign keys defs unintentionally broken in r3333
alecpl authored
86 REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
8248e4a Aleksander Machniak - 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 Aleksander Machniak - fix foreign keys defs unintentionally broken in r3333
alecpl authored
88 REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
8248e4a Aleksander Machniak - Add workaround for MySQL bug [http://bugs.mysql.com/bug.php?id=46293] ...
alecpl authored
89
951c07b Aleksander Machniak - 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 Aleksander Machniak - fix add index
alecpl authored
94 ALTER TABLE `identities` ADD INDEX `user_identities_index` (`user_id`, `del`);
a35062a Thomas B. 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 Aleksander Machniak - re-fix (#1486474) + require MySQL 4.0.8 + add index/update in identiti...
alecpl authored
96
a61bbb2 Thomas B. 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 Aleksander Machniak - fix default datetime
alecpl authored
100 `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
a61bbb2 Thomas B. 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 Aleksander Machniak - fix default datetime
alecpl authored
112 `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
a61bbb2 Thomas B. 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 Aleksander Machniak - typo
alecpl authored
120 /*!40014 SET FOREIGN_KEY_CHECKS=1 */;
e2402ef Aleksander Machniak - 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 Aleksander Machniak - 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 Aleksander Machniak - 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 Thomas B. Clear message cache table when upgrading
thomascube authored
134 TRUNCATE TABLE `messages`;
135
faf10e8 Thomas B. 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 Thomas B. Fulltext search over contact fields. Attention: DATABASE SCHEMA CHANGED\...
thomascube authored
140
141 ALTER TABLE `contacts` ADD `words` TEXT NULL AFTER `vcard`;
09b0e36 Thomas B. 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 Aleksander Machniak - Add index on contactgroupmembers.contact_id column.
alecpl authored
143 ALTER TABLE `contactgroupmembers` ADD INDEX `contactgroupmembers_contact_index` (`contact_id`);
d08333e Aleksander Machniak - Fix problems with subfolders of INBOX folder on some IMAP servers (#14...
alecpl authored
144
145 TRUNCATE TABLE `messages`;
146 TRUNCATE TABLE `cache`;
66df084 Aleksander Machniak - Merge devel-spellcheck branch:
alecpl authored
147
502436d Thomas B. We're on the road towards 0.7 now
thomascube authored
148 -- Updates from version 0.6
66df084 Aleksander Machniak - Merge devel-spellcheck branch:
alecpl authored
149
d5ae977 Aleksander Machniak - Fix username case-insensitivity issue in MySQL (#1488021)
alecpl authored
150 ALTER TABLE `users` CHANGE `alias` `alias` varchar(128) BINARY NOT NULL;
151 ALTER TABLE `users` CHANGE `username` `username` varchar(128) BINARY NOT NULL;
152
66df084 Aleksander Machniak - Merge devel-spellcheck branch:
alecpl authored
153 CREATE TABLE `dictionary` (
154 `user_id` int(10) UNSIGNED DEFAULT NULL,
155 `language` varchar(5) NOT NULL,
156 `data` longtext NOT NULL,
157 CONSTRAINT `user_id_fk_dictionary` FOREIGN KEY (`user_id`)
158 REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
159 UNIQUE `uniqueness` (`user_id`, `language`)
160 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
f8e48df Aleksander Machniak - Merge devel-saved_search branch (Addressbook Saved Searches)
alecpl authored
161
162 CREATE TABLE `searches` (
163 `search_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
164 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
165 `type` int(3) NOT NULL DEFAULT '0',
166 `name` varchar(128) NOT NULL,
167 `data` text,
168 PRIMARY KEY(`search_id`),
169 CONSTRAINT `user_id_fk_searches` FOREIGN KEY (`user_id`)
170 REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
171 UNIQUE `uniqueness` (`user_id`, `type`, `name`)
172 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
80152b3 Aleksander Machniak - Rewritten messages caching (merged devel-mcache branch):
alecpl authored
173
174 DROP TABLE `messages`;
175
176 CREATE TABLE `cache_index` (
177 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
178 `mailbox` varchar(255) BINARY NOT NULL,
179 `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
7b2bf71 Aleksander Machniak - Add lost cache_index.valid column definition
alecpl authored
180 `valid` tinyint(1) NOT NULL DEFAULT '0',
80152b3 Aleksander Machniak - Rewritten messages caching (merged devel-mcache branch):
alecpl authored
181 `data` longtext NOT NULL,
182 CONSTRAINT `user_id_fk_cache_index` FOREIGN KEY (`user_id`)
183 REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
184 INDEX `changed_index` (`changed`),
185 PRIMARY KEY (`user_id`, `mailbox`)
186 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
187
188 CREATE TABLE `cache_thread` (
189 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
190 `mailbox` varchar(255) BINARY NOT NULL,
191 `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
192 `data` longtext NOT NULL,
193 CONSTRAINT `user_id_fk_cache_thread` FOREIGN KEY (`user_id`)
194 REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
195 INDEX `changed_index` (`changed`),
196 PRIMARY KEY (`user_id`, `mailbox`)
197 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
198
199 CREATE TABLE `cache_messages` (
200 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
201 `mailbox` varchar(255) BINARY NOT NULL,
202 `uid` int(11) UNSIGNED NOT NULL DEFAULT '0',
203 `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
204 `data` longtext NOT NULL,
609d392 Aleksander Machniak - Cache synchronization using QRESYNC/CONDSTORE
alecpl authored
205 `flags` int(11) NOT NULL DEFAULT '0',
80152b3 Aleksander Machniak - Rewritten messages caching (merged devel-mcache branch):
alecpl authored
206 CONSTRAINT `user_id_fk_cache_messages` FOREIGN KEY (`user_id`)
207 REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
208 INDEX `changed_index` (`changed`),
209 PRIMARY KEY (`user_id`, `mailbox`, `uid`)
210 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
3ad2b1b Aleksander Machniak - Applied fixes from trunk up to r5479
alecpl authored
211
212 -- Updates from version 0.7-beta
213
214 ALTER TABLE `session` CHANGE `sess_id` `sess_id` varchar(128) NOT NULL;
a33118f Aleksander Machniak - Applied fixes from trunk up to r5711
alecpl authored
215
216 -- Updates from version 0.7
217
be43144 Aleksander Machniak - Applied fixes from trunk up to r5756
alecpl authored
218 /*!40014 SET FOREIGN_KEY_CHECKS=0 */;
219
a33118f Aleksander Machniak - Applied fixes from trunk up to r5711
alecpl authored
220 ALTER TABLE `contacts` DROP FOREIGN KEY `user_id_fk_contacts`;
221 ALTER TABLE `contacts` DROP INDEX `user_contacts_index`;
be43144 Aleksander Machniak - Applied fixes from trunk up to r5756
alecpl authored
222 ALTER TABLE `contacts` MODIFY `email` text NOT NULL;
a33118f Aleksander Machniak - Applied fixes from trunk up to r5711
alecpl authored
223 ALTER TABLE `contacts` ADD INDEX `user_contacts_index` (`user_id`,`del`);
224 ALTER TABLE `contacts` ADD CONSTRAINT `user_id_fk_contacts` FOREIGN KEY (`user_id`)
225 REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
226
227 ALTER TABLE `cache` ALTER `user_id` DROP DEFAULT;
228 ALTER TABLE `cache_index` ALTER `user_id` DROP DEFAULT;
229 ALTER TABLE `cache_thread` ALTER `user_id` DROP DEFAULT;
230 ALTER TABLE `cache_messages` ALTER `user_id` DROP DEFAULT;
231 ALTER TABLE `contacts` ALTER `user_id` DROP DEFAULT;
232 ALTER TABLE `contactgroups` ALTER `user_id` DROP DEFAULT;
233 ALTER TABLE `contactgroupmembers` ALTER `contact_id` DROP DEFAULT;
234 ALTER TABLE `identities` ALTER `user_id` DROP DEFAULT;
235 ALTER TABLE `searches` ALTER `user_id` DROP DEFAULT;
be43144 Aleksander Machniak - Applied fixes from trunk up to r5756
alecpl authored
236
237 /*!40014 SET FOREIGN_KEY_CHECKS=1 */;
Something went wrong with that request. Please try again.