thomascube
2010-04-20 23362230b59e89c63743c8d174f0fe11533e59b2
commit | author | age
f7bfec 1 -- RoundCube Webmail update script for SQLite databases
ac26b9 2 -- Updates from version 0.1-stable to 0.1.1
f7bfec 3
T 4 DROP TABLE messages;
5
6 CREATE TABLE messages (
7   message_id integer NOT NULL PRIMARY KEY,
8   user_id integer NOT NULL default '0',
9   del tinyint NOT NULL default '0',
10   cache_key varchar(128) NOT NULL default '',
11   created datetime NOT NULL default '0000-00-00 00:00:00',
12   idx integer NOT NULL default '0',
13   uid integer NOT NULL default '0',
14   subject varchar(255) NOT NULL default '',
15   "from" varchar(255) NOT NULL default '',
16   "to" varchar(255) NOT NULL default '',
ac26b9 17   "cc" varchar(255) NOT NULL default '',
T 18   "date" datetime NOT NULL default '0000-00-00 00:00:00',
f7bfec 19   size integer NOT NULL default '0',
T 20   headers text NOT NULL,
21   structure text
22 );
23
ac26b9 24 CREATE INDEX ix_messages_user_cache_uid ON messages(user_id,cache_key,uid);
6cb778 25 CREATE INDEX ix_users_username ON users(username);
A 26 CREATE INDEX ix_users_alias ON users(alias);
c98f3b 27
A 28 -- Updates from version 0.2-alpha
29
30 CREATE INDEX ix_messages_created ON messages (created);
3e48d2 31
A 32 -- Updates from version 0.2-beta
33
34 CREATE INDEX ix_session_changed ON session (changed);
e4d9f0 35 CREATE INDEX ix_cache_created ON cache (created);
3d601d 36
A 37 -- Updates from version 0.3-stable
38
9273c8 39 DELETE FROM messages;
3d601d 40 DROP INDEX ix_messages_user_cache_uid;
A 41 CREATE UNIQUE INDEX ix_messages_user_cache_uid ON messages (user_id,cache_key,uid);
42 CREATE INDEX ix_messages_index ON messages (user_id,cache_key,idx);
23b765 43 DROP INDEX ix_contacts_user_id;
A 44 CREATE INDEX ix_contacts_user_id ON contacts(user_id, email);
94fe9c 45
A 46 -- Updates from version 0.3.1
47
233622 48 -- ALTER TABLE identities ADD COLUMN changed datetime NOT NULL default '0000-00-00 00:00:00'; --
a61bbb 49
233622 50 CREATE TABLE temp_identities (
T 51   identity_id integer NOT NULL PRIMARY KEY,
52   user_id integer NOT NULL default '0',
53   standard tinyint NOT NULL default '0',
54   name varchar(128) NOT NULL default '',
55   organization varchar(128) default '',
56   email varchar(128) NOT NULL default '',
57   "reply-to" varchar(128) NOT NULL default '',
58   bcc varchar(128) NOT NULL default '',
59   signature text NOT NULL default '',
60   html_signature tinyint NOT NULL default '0'
61 );
62 INSERT INTO temp_identities (identity_id, user_id, standard, name, organization, email, "reply-to", bcc, signature, html_signature)
63   SELECT identity_id, user_id, standard, name, organization, email, "reply-to", bcc, signature, html_signature
64   FROM identities WHERE del=0;
65
66 DROP INDEX ix_identities_user_id;
67 DROP TABLE identities;
68
69 CREATE TABLE identities (
70   identity_id integer NOT NULL PRIMARY KEY,
71   user_id integer NOT NULL default '0',
72   changed datetime NOT NULL default '0000-00-00 00:00:00',
73   del tinyint NOT NULL default '0',
74   standard tinyint NOT NULL default '0',
75   name varchar(128) NOT NULL default '',
76   organization varchar(128) default '',
77   email varchar(128) NOT NULL default '',
78   "reply-to" varchar(128) NOT NULL default '',
79   bcc varchar(128) NOT NULL default '',
80   signature text NOT NULL default '',
81   html_signature tinyint NOT NULL default '0'
82 );
83 CREATE INDEX ix_identities_user_id ON identities(user_id, del);
84
85 INSERT INTO identities (identity_id, user_id, standard, name, organization, email, "reply-to", bcc, signature, html_signature)
86   SELECT identity_id, user_id, standard, name, organization, email, "reply-to", bcc, signature, html_signature
87   FROM temp_identities;
88
89 DROP TABLE temp_identities;
a35062 90
a61bbb 91 CREATE TABLE contactgroups (
T 92   contactgroup_id integer NOT NULL PRIMARY KEY,
93   user_id integer NOT NULL default '0',
94   changed datetime NOT NULL default '0000-00-00 00:00:00',
95   del tinyint NOT NULL default '0',
96   name varchar(128) NOT NULL default ''
97 );
98
99 CREATE INDEX ix_contactgroups_user_id ON contactgroups(user_id, del);
100
101 CREATE TABLE contactgroupmembers (
102   contactgroup_id integer NOT NULL,
103   contact_id integer NOT NULL default '0',
104   created datetime NOT NULL default '0000-00-00 00:00:00',
105   PRIMARY KEY (contactgroup_id, contact_id)
106 );
107