1 -- RoundCube Webmail initial database structure
4 -- --------------------------------------------------------
6 SET FOREIGN_KEY_CHECKS=0;
9 -- Table structure for table `session`
11 CREATE TABLE `session` (
12 `sess_id` varchar(40) NOT NULL,
13 `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
14 `changed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
15 `ip` varchar(15) NOT NULL,
17 PRIMARY KEY(`sess_id`)
18 ) TYPE=MYISAM CHARACTER SET ascii COLLATE ascii_general_ci;
21 -- Table structure for table `users`
23 CREATE TABLE `users` (
24 `user_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
25 `username` varchar(128) NOT NULL,
26 `mail_host` varchar(128) NOT NULL,
27 `alias` varchar(128) NOT NULL,
28 `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
29 `last_login` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
30 `language` varchar(5) NOT NULL DEFAULT 'en',
31 `preferences` text NOT NULL DEFAULT '',
32 PRIMARY KEY(`user_id`)
33 ) TYPE=MYISAM 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) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
43 `created` datetime NOT NULL DEFAULT '0000-00-00 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 '0000-00-00 00:00:00',
51 `size` int(11) UNSIGNED NOT NULL DEFAULT '0',
52 `headers` text NOT NULL,
54 PRIMARY KEY(`message_id`),
57 UNIQUE `uniqueness` (`user_id`, `cache_key`, `uid`),
58 CONSTRAINT `user_id_fk_messages` FOREIGN KEY (`user_id`)
59 REFERENCES `users`(`user_id`)
62 ) TYPE=MYISAM 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 `session_id` varchar(40) CHARACTER SET ascii COLLATE ascii_general_ci,
70 `cache_key` varchar(128) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL,
71 `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
72 `data` longtext NOT NULL,
73 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
74 PRIMARY KEY(`cache_id`),
75 INDEX `cache_key`(`cache_key`),
76 INDEX `session_id`(`session_id`),
77 CONSTRAINT `user_id_fk_cache` FOREIGN KEY (`user_id`)
78 REFERENCES `users`(`user_id`)
81 ) TYPE=MYISAM 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 '0000-00-00 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`)
101 ) TYPE=MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;
104 -- Table structure for table `identities`
106 CREATE TABLE `identities` (
107 `identity_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
108 `del` tinyint(1) NOT NULL DEFAULT '0',
109 `standard` tinyint(1) NOT NULL DEFAULT '0',
110 `name` varchar(128) NOT NULL,
111 `organization` varchar(128) NOT NULL,
112 `email` varchar(128) NOT NULL,
113 `reply-to` varchar(128) NOT NULL,
114 `bcc` varchar(128) NOT NULL,
115 `signature` text NOT NULL,
116 `html_signature` tinyint(1) NOT NULL DEFAULT '0',
117 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
118 PRIMARY KEY(`identity_id`),
119 CONSTRAINT `user_id_fk_identities` FOREIGN KEY (`user_id`)
120 REFERENCES `users`(`user_id`)
123 ) TYPE=MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;
126 SET FOREIGN_KEY_CHECKS=1;