1 -- RoundCube Webmail initial database structure
4 /*!40014 SET FOREIGN_KEY_CHECKS=0 */;
6 -- Table structure for table `session`
8 CREATE TABLE `session` (
9 `sess_id` varchar(40) NOT NULL,
10 `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
11 `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
12 `ip` varchar(40) NOT NULL,
14 PRIMARY KEY(`sess_id`),
15 INDEX `changed_index` (`changed`)
16 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
19 -- Table structure for table `users`
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,
26 `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
27 `last_login` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
28 `language` varchar(5),
30 PRIMARY KEY(`user_id`),
31 INDEX `username_index` (`username`),
32 INDEX `alias_index` (`alias`)
33 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
36 -- Table structure for table `messages`
38 CREATE TABLE `messages` (
39 `message_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
40 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
41 `del` tinyint(1) NOT NULL DEFAULT '0',
42 `cache_key` varchar(128) /*!40101 CHARACTER SET ascii COLLATE ascii_general_ci */ NOT NULL,
43 `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
44 `idx` int(11) UNSIGNED NOT NULL DEFAULT '0',
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,
50 `date` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
51 `size` int(11) UNSIGNED NOT NULL DEFAULT '0',
52 `headers` text NOT NULL,
54 PRIMARY KEY(`message_id`),
55 INDEX `created_index` (`created`),
56 UNIQUE `uniqueness` (`user_id`, `cache_key`, `uid`),
57 CONSTRAINT `user_id_fk_messages` FOREIGN KEY (`user_id`)
58 REFERENCES `users`(`user_id`)
62 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
65 -- Table structure for table `cache`
67 CREATE TABLE `cache` (
68 `cache_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
69 `cache_key` varchar(128) /*!40101 CHARACTER SET ascii COLLATE ascii_general_ci */ NOT NULL ,
70 `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
71 `data` longtext NOT NULL,
72 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
73 PRIMARY KEY(`cache_id`),
74 INDEX `created_index` (`created`),
75 INDEX `user_cache_index` (`user_id`,`cache_key`),
76 CONSTRAINT `user_id_fk_cache` FOREIGN KEY (`user_id`)
77 REFERENCES `users`(`user_id`)
81 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
84 -- Table structure for table `contacts`
86 CREATE TABLE `contacts` (
87 `contact_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
88 `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
89 `del` tinyint(1) NOT NULL DEFAULT '0',
90 `name` varchar(128) NOT NULL,
91 `email` varchar(128) NOT NULL,
92 `firstname` varchar(128) NOT NULL,
93 `surname` varchar(128) NOT NULL,
95 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
96 PRIMARY KEY(`contact_id`),
97 CONSTRAINT `user_id_fk_contacts` FOREIGN KEY (`user_id`)
98 REFERENCES `users`(`user_id`)
102 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
105 -- Table structure for table `identities`
107 CREATE TABLE `identities` (
108 `identity_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
109 `del` tinyint(1) NOT NULL DEFAULT '0',
110 `standard` tinyint(1) NOT NULL DEFAULT '0',
111 `name` varchar(128) NOT NULL,
112 `organization` varchar(128) NOT NULL DEFAULT '',
113 `email` varchar(128) NOT NULL,
114 `reply-to` varchar(128) NOT NULL DEFAULT '',
115 `bcc` varchar(128) NOT NULL DEFAULT '',
117 `html_signature` tinyint(1) NOT NULL DEFAULT '0',
118 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
119 PRIMARY KEY(`identity_id`),
120 CONSTRAINT `user_id_fk_identities` FOREIGN KEY (`user_id`)
121 REFERENCES `users`(`user_id`)
125 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
128 /*!40014 SET FOREIGN_KEY_CHECKS=1 */;