RoundCube Webmail
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

212 lines
7.8 KiB

18 years ago
  1. -- Roundcube Webmail initial database structure
  2. /*!40014 SET FOREIGN_KEY_CHECKS=0 */;
  3. -- Table structure for table `session`
  4. CREATE TABLE `session` (
  5. `sess_id` varchar(128) NOT NULL,
  6. `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
  7. `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
  8. `ip` varchar(40) NOT NULL,
  9. `vars` mediumtext NOT NULL,
  10. PRIMARY KEY(`sess_id`),
  11. INDEX `changed_index` (`changed`)
  12. ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
  13. -- Table structure for table `users`
  14. CREATE TABLE `users` (
  15. `user_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  16. `username` varchar(128) BINARY NOT NULL,
  17. `mail_host` varchar(128) NOT NULL,
  18. `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
  19. `last_login` datetime DEFAULT NULL,
  20. `language` varchar(5),
  21. `preferences` longtext,
  22. PRIMARY KEY(`user_id`),
  23. UNIQUE `username` (`username`, `mail_host`)
  24. ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
  25. -- Table structure for table `cache`
  26. CREATE TABLE `cache` (
  27. `user_id` int(10) UNSIGNED NOT NULL,
  28. `cache_key` varchar(128) /*!40101 CHARACTER SET ascii COLLATE ascii_general_ci */ NOT NULL,
  29. `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
  30. `expires` datetime DEFAULT NULL,
  31. `data` longtext NOT NULL,
  32. CONSTRAINT `user_id_fk_cache` FOREIGN KEY (`user_id`)
  33. REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  34. INDEX `expires_index` (`expires`),
  35. INDEX `user_cache_index` (`user_id`,`cache_key`)
  36. ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
  37. -- Table structure for table `cache_shared`
  38. CREATE TABLE `cache_shared` (
  39. `cache_key` varchar(255) /*!40101 CHARACTER SET ascii COLLATE ascii_general_ci */ NOT NULL,
  40. `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
  41. `expires` datetime DEFAULT NULL,
  42. `data` longtext NOT NULL,
  43. INDEX `expires_index` (`expires`),
  44. INDEX `cache_key_index` (`cache_key`)
  45. ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
  46. -- Table structure for table `cache_index`
  47. CREATE TABLE `cache_index` (
  48. `user_id` int(10) UNSIGNED NOT NULL,
  49. `mailbox` varchar(255) BINARY NOT NULL,
  50. `expires` datetime DEFAULT NULL,
  51. `valid` tinyint(1) NOT NULL DEFAULT '0',
  52. `data` longtext NOT NULL,
  53. CONSTRAINT `user_id_fk_cache_index` FOREIGN KEY (`user_id`)
  54. REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  55. INDEX `expires_index` (`expires`),
  56. PRIMARY KEY (`user_id`, `mailbox`)
  57. ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
  58. -- Table structure for table `cache_thread`
  59. CREATE TABLE `cache_thread` (
  60. `user_id` int(10) UNSIGNED NOT NULL,
  61. `mailbox` varchar(255) BINARY NOT NULL,
  62. `expires` datetime DEFAULT NULL,
  63. `data` longtext NOT NULL,
  64. CONSTRAINT `user_id_fk_cache_thread` FOREIGN KEY (`user_id`)
  65. REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  66. INDEX `expires_index` (`expires`),
  67. PRIMARY KEY (`user_id`, `mailbox`)
  68. ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
  69. -- Table structure for table `cache_messages`
  70. CREATE TABLE `cache_messages` (
  71. `user_id` int(10) UNSIGNED NOT NULL,
  72. `mailbox` varchar(255) BINARY NOT NULL,
  73. `uid` int(11) UNSIGNED NOT NULL DEFAULT '0',
  74. `expires` datetime DEFAULT NULL,
  75. `data` longtext NOT NULL,
  76. `flags` int(11) NOT NULL DEFAULT '0',
  77. CONSTRAINT `user_id_fk_cache_messages` FOREIGN KEY (`user_id`)
  78. REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  79. INDEX `expires_index` (`expires`),
  80. PRIMARY KEY (`user_id`, `mailbox`, `uid`)
  81. ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
  82. -- Table structure for table `contacts`
  83. CREATE TABLE `contacts` (
  84. `contact_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  85. `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
  86. `del` tinyint(1) NOT NULL DEFAULT '0',
  87. `name` varchar(128) NOT NULL DEFAULT '',
  88. `email` text NOT NULL,
  89. `firstname` varchar(128) NOT NULL DEFAULT '',
  90. `surname` varchar(128) NOT NULL DEFAULT '',
  91. `vcard` longtext NULL,
  92. `words` text NULL,
  93. `user_id` int(10) UNSIGNED NOT NULL,
  94. PRIMARY KEY(`contact_id`),
  95. CONSTRAINT `user_id_fk_contacts` FOREIGN KEY (`user_id`)
  96. REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  97. INDEX `user_contacts_index` (`user_id`,`del`)
  98. ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
  99. -- Table structure for table `contactgroups`
  100. CREATE TABLE `contactgroups` (
  101. `contactgroup_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  102. `user_id` int(10) UNSIGNED NOT NULL,
  103. `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
  104. `del` tinyint(1) NOT NULL DEFAULT '0',
  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. CREATE TABLE `contactgroupmembers` (
  112. `contactgroup_id` int(10) UNSIGNED NOT NULL,
  113. `contact_id` int(10) UNSIGNED NOT NULL,
  114. `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
  115. PRIMARY KEY (`contactgroup_id`, `contact_id`),
  116. CONSTRAINT `contactgroup_id_fk_contactgroups` FOREIGN KEY (`contactgroup_id`)
  117. REFERENCES `contactgroups`(`contactgroup_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  118. CONSTRAINT `contact_id_fk_contacts` FOREIGN KEY (`contact_id`)
  119. REFERENCES `contacts`(`contact_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  120. INDEX `contactgroupmembers_contact_index` (`contact_id`)
  121. ) /*!40000 ENGINE=INNODB */;
  122. -- Table structure for table `identities`
  123. CREATE TABLE `identities` (
  124. `identity_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  125. `user_id` int(10) UNSIGNED NOT NULL,
  126. `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
  127. `del` tinyint(1) NOT NULL DEFAULT '0',
  128. `standard` tinyint(1) NOT NULL DEFAULT '0',
  129. `name` varchar(128) NOT NULL,
  130. `organization` varchar(128) NOT NULL DEFAULT '',
  131. `email` varchar(128) NOT NULL,
  132. `reply-to` varchar(128) NOT NULL DEFAULT '',
  133. `bcc` varchar(128) NOT NULL DEFAULT '',
  134. `signature` longtext,
  135. `html_signature` tinyint(1) NOT NULL DEFAULT '0',
  136. PRIMARY KEY(`identity_id`),
  137. CONSTRAINT `user_id_fk_identities` FOREIGN KEY (`user_id`)
  138. REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  139. INDEX `user_identities_index` (`user_id`, `del`),
  140. INDEX `email_identities_index` (`email`, `del`)
  141. ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
  142. -- Table structure for table `dictionary`
  143. CREATE TABLE `dictionary` (
  144. `user_id` int(10) UNSIGNED DEFAULT NULL,
  145. `language` varchar(5) NOT NULL,
  146. `data` longtext NOT NULL,
  147. CONSTRAINT `user_id_fk_dictionary` FOREIGN KEY (`user_id`)
  148. REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  149. UNIQUE `uniqueness` (`user_id`, `language`)
  150. ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
  151. -- Table structure for table `searches`
  152. CREATE TABLE `searches` (
  153. `search_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  154. `user_id` int(10) UNSIGNED NOT NULL,
  155. `type` int(3) NOT NULL DEFAULT '0',
  156. `name` varchar(128) NOT NULL,
  157. `data` text,
  158. PRIMARY KEY(`search_id`),
  159. CONSTRAINT `user_id_fk_searches` FOREIGN KEY (`user_id`)
  160. REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  161. UNIQUE `uniqueness` (`user_id`, `type`, `name`)
  162. ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
  163. -- Table structure for table `system`
  164. CREATE TABLE `system` (
  165. `name` varchar(64) NOT NULL,
  166. `value` mediumtext,
  167. PRIMARY KEY(`name`)
  168. ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
  169. /*!40014 SET FOREIGN_KEY_CHECKS=1 */;
  170. INSERT INTO system (name, value) VALUES ('roundcube-version', '2015030800');