您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

mysql.initial.sql 7.9KB

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