alecpl
2011-07-05 9d195d6e82c3be4e543a47ef8ff1e9fe54bd0939
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`),
ace511 31  UNIQUE `username` (`username`, `mail_host`),
6cb778 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 '',
6f0968 86  `email` varchar(255) NOT NULL,
951c07 87  `firstname` varchar(128) NOT NULL DEFAULT '',
A 88  `surname` varchar(128) NOT NULL DEFAULT '',
09b0e3 89  `vcard` longtext NULL,
3e2637 90  `words` text NULL,
aade7b 91  `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
T 92  PRIMARY KEY(`contact_id`),
94fe9c 93  CONSTRAINT `user_id_fk_contacts` FOREIGN KEY (`user_id`)
A 94    REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
8248e4 95  INDEX `user_contacts_index` (`user_id`,`email`)
2bedfa 96 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
aade7b 97
a61bbb 98 -- Table structure for table `contactgroups`
T 99
100 CREATE TABLE `contactgroups` (
101   `contactgroup_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
102   `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
192413 103   `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
a61bbb 104   `del` tinyint(1) NOT NULL DEFAULT '0',
T 105   `name` varchar(128) NOT NULL DEFAULT '',
106   PRIMARY KEY(`contactgroup_id`),
107   CONSTRAINT `user_id_fk_contactgroups` FOREIGN KEY (`user_id`)
108     REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
109   INDEX `contactgroups_user_index` (`user_id`,`del`)
110 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
111
112 CREATE TABLE `contactgroupmembers` (
113   `contactgroup_id` int(10) UNSIGNED NOT NULL,
114   `contact_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
192413 115   `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
a61bbb 116   PRIMARY KEY (`contactgroup_id`, `contact_id`),
T 117   CONSTRAINT `contactgroup_id_fk_contactgroups` FOREIGN KEY (`contactgroup_id`)
118     REFERENCES `contactgroups`(`contactgroup_id`) ON DELETE CASCADE ON UPDATE CASCADE,
119   CONSTRAINT `contact_id_fk_contacts` FOREIGN KEY (`contact_id`)
3a5476 120     REFERENCES `contacts`(`contact_id`) ON DELETE CASCADE ON UPDATE CASCADE,
A 121   INDEX `contactgroupmembers_contact_index` (`contact_id`)
a61bbb 122 ) /*!40000 ENGINE=INNODB */;
T 123
aade7b 124
T 125 -- Table structure for table `identities`
126
127 CREATE TABLE `identities` (
128  `identity_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
a35062 129  `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
T 130  `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
aade7b 131  `del` tinyint(1) NOT NULL DEFAULT '0',
T 132  `standard` tinyint(1) NOT NULL DEFAULT '0',
133  `name` varchar(128) NOT NULL,
d7f3d7 134  `organization` varchar(128) NOT NULL DEFAULT '',
aade7b 135  `email` varchar(128) NOT NULL,
d7f3d7 136  `reply-to` varchar(128) NOT NULL DEFAULT '',
A 137  `bcc` varchar(128) NOT NULL DEFAULT '',
f18911 138  `signature` text,
a0109c 139  `html_signature` tinyint(1) NOT NULL DEFAULT '0',
94fe9c 140  PRIMARY KEY(`identity_id`),
A 141  CONSTRAINT `user_id_fk_identities` FOREIGN KEY (`user_id`)
142    REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
143  INDEX `user_identities_index` (`user_id`, `del`)
2bedfa 144 ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
8248e4 145
aade7b 146
2bedfa 147 /*!40014 SET FOREIGN_KEY_CHECKS=1 */;