]> git.donarmstrong.com Git - roundcube.git/blob - SQL/mysql.initial.sql
Imported Upstream version 0.2.1
[roundcube.git] / SQL / mysql.initial.sql
1 -- RoundCube Webmail initial database structure
2 -- Version 0.2
3
4 -- --------------------------------------------------------
5
6 /*!40014  SET FOREIGN_KEY_CHECKS=0 */;
7
8
9 -- Table structure for table `session`
10
11 CREATE TABLE `session` (
12  `sess_id` varchar(40) NOT NULL,
13  `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
14  `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
15  `ip` varchar(40) NOT NULL,
16  `vars` text NOT NULL,
17  PRIMARY KEY(`sess_id`),
18  INDEX `changed_index` (`changed`)
19 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
20
21
22 -- Table structure for table `users`
23
24 CREATE TABLE `users` (
25  `user_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
26  `username` varchar(128) NOT NULL,
27  `mail_host` varchar(128) NOT NULL,
28  `alias` varchar(128) NOT NULL,
29  `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
30  `last_login` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
31  `language` varchar(5),
32  `preferences` text,
33  PRIMARY KEY(`user_id`),
34  INDEX `username_index` (`username`),
35  INDEX `alias_index` (`alias`)
36 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
37
38
39 -- Table structure for table `messages`
40
41 CREATE TABLE `messages` (
42  `message_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
43  `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
44  `del` tinyint(1) NOT NULL DEFAULT '0',
45  `cache_key` varchar(128) /*!40101 CHARACTER SET ascii COLLATE ascii_general_ci */ NOT NULL,
46  `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
47  `idx` int(11) UNSIGNED NOT NULL DEFAULT '0',
48  `uid` int(11) UNSIGNED NOT NULL DEFAULT '0',
49  `subject` varchar(255) NOT NULL,
50  `from` varchar(255) NOT NULL,
51  `to` varchar(255) NOT NULL,
52  `cc` varchar(255) NOT NULL,
53  `date` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
54  `size` int(11) UNSIGNED NOT NULL DEFAULT '0',
55  `headers` text NOT NULL,
56  `structure` text,
57  PRIMARY KEY(`message_id`),
58  INDEX `created_index` (`created`),
59  UNIQUE `uniqueness` (`user_id`, `cache_key`, `uid`),
60  CONSTRAINT `user_id_fk_messages` FOREIGN KEY (`user_id`)
61    REFERENCES `users`(`user_id`)
62    /*!40008
63      ON DELETE CASCADE
64      ON UPDATE CASCADE */
65 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
66
67
68 -- Table structure for table `cache`
69
70 CREATE TABLE `cache` (
71  `cache_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
72  `cache_key` varchar(128) /*!40101 CHARACTER SET ascii COLLATE ascii_general_ci */ NOT NULL ,
73  `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
74  `data` longtext NOT NULL,
75  `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
76  PRIMARY KEY(`cache_id`),
77  INDEX `created_index` (`created`),
78  INDEX `user_cache_index` (`user_id`,`cache_key`),
79  CONSTRAINT `user_id_fk_cache` FOREIGN KEY (`user_id`)
80    REFERENCES `users`(`user_id`)
81    /*!40008
82      ON DELETE CASCADE
83      ON UPDATE CASCADE */
84 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
85
86
87 -- Table structure for table `contacts`
88
89 CREATE TABLE `contacts` (
90  `contact_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
91  `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
92  `del` tinyint(1) NOT NULL DEFAULT '0',
93  `name` varchar(128) NOT NULL,
94  `email` varchar(128) NOT NULL,
95  `firstname` varchar(128) NOT NULL,
96  `surname` varchar(128) NOT NULL,
97  `vcard` text NULL,
98  `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
99  PRIMARY KEY(`contact_id`),
100  CONSTRAINT `user_id_fk_contacts` FOREIGN KEY (`user_id`)
101    REFERENCES `users`(`user_id`)
102    /*!40008
103      ON DELETE CASCADE
104      ON UPDATE CASCADE */
105 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
106
107
108 -- Table structure for table `identities`
109
110 CREATE TABLE `identities` (
111  `identity_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
112  `del` tinyint(1) NOT NULL DEFAULT '0',
113  `standard` tinyint(1) NOT NULL DEFAULT '0',
114  `name` varchar(128) NOT NULL,
115  `organization` varchar(128) NOT NULL DEFAULT '',
116  `email` varchar(128) NOT NULL,
117  `reply-to` varchar(128) NOT NULL DEFAULT '',
118  `bcc` varchar(128) NOT NULL DEFAULT '',
119  `signature` text,
120  `html_signature` tinyint(1) NOT NULL DEFAULT '0',
121  `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
122  PRIMARY KEY(`identity_id`),
123  CONSTRAINT `user_id_fk_identities` FOREIGN KEY (`user_id`)
124    REFERENCES `users`(`user_id`)
125    /*!40008
126      ON DELETE CASCADE
127      ON UPDATE CASCADE */
128 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
129
130
131 /*!40014 SET FOREIGN_KEY_CHECKS=1 */;