alecpl
2010-09-25 e019f2d0f2dc2fbfa345ab5d7ae85e67bfdd76b8
commit | author | age
e019f2 1 -- Roundcube Webmail initial database structure
aade7b 2
T 3
2bedfa 4 /*!40014  SET FOREIGN_KEY_CHECKS=0 */;
aade7b 5
T 6 -- Table structure for table `session`
7
8 CREATE TABLE `session` (
9  `sess_id` varchar(40) NOT NULL,
37974e 10  `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
A 11  `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
84d06e 12  `ip` varchar(40) NOT NULL,
b2b8b1 13  `vars` mediumtext NOT NULL,
3e48d2 14  PRIMARY KEY(`sess_id`),
A 15  INDEX `changed_index` (`changed`)
2bedfa 16 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
aade7b 17
T 18
19 -- Table structure for table `users`
20
21 CREATE TABLE `users` (
22  `user_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
23  `username` varchar(128) NOT NULL,
24  `mail_host` varchar(128) NOT NULL,
25  `alias` varchar(128) NOT NULL,
37974e 26  `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
e2402e 27  `last_login` datetime DEFAULT NULL,
debdda 28  `language` varchar(5),
112bff 29  `preferences` text,
6cb778 30  PRIMARY KEY(`user_id`),
A 31  INDEX `username_index` (`username`),
32  INDEX `alias_index` (`alias`)
2bedfa 33 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
aade7b 34
T 35
36 -- Table structure for table `messages`
37
38 CREATE TABLE `messages` (
39  `message_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
f7bfec 40  `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
aade7b 41  `del` tinyint(1) NOT NULL DEFAULT '0',
2bedfa 42  `cache_key` varchar(128) /*!40101 CHARACTER SET ascii COLLATE ascii_general_ci */ NOT NULL,
37974e 43  `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
aade7b 44  `idx` int(11) UNSIGNED NOT NULL DEFAULT '0',
T 45  `uid` int(11) UNSIGNED NOT NULL DEFAULT '0',
46  `subject` varchar(255) NOT NULL,
47  `from` varchar(255) NOT NULL,
48  `to` varchar(255) NOT NULL,
49  `cc` varchar(255) NOT NULL,
37974e 50  `date` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
aade7b 51  `size` int(11) UNSIGNED NOT NULL DEFAULT '0',
T 52  `headers` text NOT NULL,
f7bfec 53  `structure` text,
aade7b 54  PRIMARY KEY(`message_id`),
94fe9c 55  CONSTRAINT `user_id_fk_messages` FOREIGN KEY (`user_id`)
A 56    REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
c98f3b 57  INDEX `created_index` (`created`),
3d601d 58  INDEX `index_index` (`user_id`, `cache_key`, `idx`),
8248e4 59  UNIQUE `uniqueness` (`user_id`, `cache_key`, `uid`)
2bedfa 60 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
aade7b 61
T 62
63 -- Table structure for table `cache`
64
65 CREATE TABLE `cache` (
66  `cache_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
2bedfa 67  `cache_key` varchar(128) /*!40101 CHARACTER SET ascii COLLATE ascii_general_ci */ NOT NULL ,
37974e 68  `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
aade7b 69  `data` longtext NOT NULL,
T 70  `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
71  PRIMARY KEY(`cache_id`),
94fe9c 72  CONSTRAINT `user_id_fk_cache` FOREIGN KEY (`user_id`)
A 73    REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
e4d9f0 74  INDEX `created_index` (`created`),
8248e4 75  INDEX `user_cache_index` (`user_id`,`cache_key`)
2bedfa 76 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
aade7b 77
T 78
79 -- Table structure for table `contacts`
80
81 CREATE TABLE `contacts` (
82  `contact_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
37974e 83  `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
aade7b 84  `del` tinyint(1) NOT NULL DEFAULT '0',
951c07 85  `name` varchar(128) NOT NULL DEFAULT '',
aade7b 86  `email` varchar(128) NOT NULL,
951c07 87  `firstname` varchar(128) NOT NULL DEFAULT '',
A 88  `surname` varchar(128) NOT NULL DEFAULT '',
3c3b35 89  `vcard` text NULL,
aade7b 90  `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
T 91  PRIMARY KEY(`contact_id`),
94fe9c 92  CONSTRAINT `user_id_fk_contacts` FOREIGN KEY (`user_id`)
A 93    REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
8248e4 94  INDEX `user_contacts_index` (`user_id`,`email`)
2bedfa 95 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
aade7b 96
a61bbb 97 -- Table structure for table `contactgroups`
T 98
99 CREATE TABLE `contactgroups` (
100   `contactgroup_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
101   `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
192413 102   `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
a61bbb 103   `del` tinyint(1) NOT NULL DEFAULT '0',
T 104   `name` varchar(128) NOT NULL DEFAULT '',
105   PRIMARY KEY(`contactgroup_id`),
106   CONSTRAINT `user_id_fk_contactgroups` FOREIGN KEY (`user_id`)
107     REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
108   INDEX `contactgroups_user_index` (`user_id`,`del`)
109 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
110
111 CREATE TABLE `contactgroupmembers` (
112   `contactgroup_id` int(10) UNSIGNED NOT NULL,
113   `contact_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
192413 114   `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
a61bbb 115   PRIMARY KEY (`contactgroup_id`, `contact_id`),
T 116   CONSTRAINT `contactgroup_id_fk_contactgroups` FOREIGN KEY (`contactgroup_id`)
117     REFERENCES `contactgroups`(`contactgroup_id`) ON DELETE CASCADE ON UPDATE CASCADE,
118   CONSTRAINT `contact_id_fk_contacts` FOREIGN KEY (`contact_id`)
119     REFERENCES `contacts`(`contact_id`) ON DELETE CASCADE ON UPDATE CASCADE
120 ) /*!40000 ENGINE=INNODB */;
121
aade7b 122
T 123 -- Table structure for table `identities`
124
125 CREATE TABLE `identities` (
126  `identity_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
a35062 127  `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
T 128  `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
aade7b 129  `del` tinyint(1) NOT NULL DEFAULT '0',
T 130  `standard` tinyint(1) NOT NULL DEFAULT '0',
131  `name` varchar(128) NOT NULL,
d7f3d7 132  `organization` varchar(128) NOT NULL DEFAULT '',
aade7b 133  `email` varchar(128) NOT NULL,
d7f3d7 134  `reply-to` varchar(128) NOT NULL DEFAULT '',
A 135  `bcc` varchar(128) NOT NULL DEFAULT '',
f18911 136  `signature` text,
a0109c 137  `html_signature` tinyint(1) NOT NULL DEFAULT '0',
94fe9c 138  PRIMARY KEY(`identity_id`),
A 139  CONSTRAINT `user_id_fk_identities` FOREIGN KEY (`user_id`)
140    REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
141  INDEX `user_identities_index` (`user_id`, `del`)
2bedfa 142 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
8248e4 143
aade7b 144
2bedfa 145 /*!40014 SET FOREIGN_KEY_CHECKS=1 */;