]> git.donarmstrong.com Git - roundcube.git/blob - SQL/mysql.initial.sql
Imported Upstream version 0.3
[roundcube.git] / SQL / mysql.initial.sql
1 -- RoundCube Webmail initial database structure
2
3
4 /*!40014  SET FOREIGN_KEY_CHECKS=0 */;
5
6 -- Table structure for table `session`
7
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,
13  `vars` text NOT NULL,
14  PRIMARY KEY(`sess_id`),
15  INDEX `changed_index` (`changed`)
16 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
17
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,
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),
29  `preferences` text,
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 */;
34
35
36 -- Table structure for table `messages`
37
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,
53  `structure` text,
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`)
59    /*!40008
60      ON DELETE CASCADE
61      ON UPDATE CASCADE */
62 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
63
64
65 -- Table structure for table `cache`
66
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`)
78    /*!40008
79      ON DELETE CASCADE
80      ON UPDATE CASCADE */
81 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
82
83
84 -- Table structure for table `contacts`
85
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,
94  `vcard` text 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`)
99    /*!40008
100      ON DELETE CASCADE
101      ON UPDATE CASCADE */
102 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
103
104
105 -- Table structure for table `identities`
106
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 '',
116  `signature` text,
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`)
122    /*!40008
123      ON DELETE CASCADE
124      ON UPDATE CASCADE */
125 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
126
127
128 /*!40014 SET FOREIGN_KEY_CHECKS=1 */;