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

sqlite.initial.sql 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. -- Roundcube Webmail initial database structure
  2. --
  3. -- Table structure for table contacts and related
  4. --
  5. CREATE TABLE contacts (
  6. contact_id integer NOT NULL PRIMARY KEY,
  7. user_id integer NOT NULL,
  8. changed datetime NOT NULL default '0000-00-00 00:00:00',
  9. del tinyint NOT NULL default '0',
  10. name varchar(128) NOT NULL default '',
  11. email text NOT NULL default '',
  12. firstname varchar(128) NOT NULL default '',
  13. surname varchar(128) NOT NULL default '',
  14. vcard text NOT NULL default '',
  15. words text NOT NULL default ''
  16. );
  17. CREATE INDEX ix_contacts_user_id ON contacts(user_id, del);
  18. CREATE TABLE contactgroups (
  19. contactgroup_id integer NOT NULL PRIMARY KEY,
  20. user_id integer NOT NULL default '0',
  21. changed datetime NOT NULL default '0000-00-00 00:00:00',
  22. del tinyint NOT NULL default '0',
  23. name varchar(128) NOT NULL default ''
  24. );
  25. CREATE INDEX ix_contactgroups_user_id ON contactgroups(user_id, del);
  26. CREATE TABLE contactgroupmembers (
  27. contactgroup_id integer NOT NULL,
  28. contact_id integer NOT NULL default '0',
  29. created datetime NOT NULL default '0000-00-00 00:00:00',
  30. PRIMARY KEY (contactgroup_id, contact_id)
  31. );
  32. CREATE INDEX ix_contactgroupmembers_contact_id ON contactgroupmembers (contact_id);
  33. --
  34. -- Table structure for table identities
  35. --
  36. CREATE TABLE identities (
  37. identity_id integer NOT NULL PRIMARY KEY,
  38. user_id integer NOT NULL default '0',
  39. changed datetime NOT NULL default '0000-00-00 00:00:00',
  40. del tinyint NOT NULL default '0',
  41. standard tinyint NOT NULL default '0',
  42. name varchar(128) NOT NULL default '',
  43. organization varchar(128) default '',
  44. email varchar(128) NOT NULL default '',
  45. "reply-to" varchar(128) NOT NULL default '',
  46. bcc varchar(128) NOT NULL default '',
  47. signature text NOT NULL default '',
  48. html_signature tinyint NOT NULL default '0'
  49. );
  50. CREATE INDEX ix_identities_user_id ON identities(user_id, del);
  51. CREATE INDEX ix_identities_email ON identities(email, del);
  52. --
  53. -- Table structure for table users
  54. --
  55. CREATE TABLE users (
  56. user_id integer NOT NULL PRIMARY KEY,
  57. username varchar(128) NOT NULL default '',
  58. mail_host varchar(128) NOT NULL default '',
  59. created datetime NOT NULL default '0000-00-00 00:00:00',
  60. last_login datetime DEFAULT NULL,
  61. failed_login datetime DEFAULT NULL,
  62. failed_login_counter integer DEFAULT NULL,
  63. language varchar(5),
  64. preferences text NOT NULL default ''
  65. );
  66. CREATE UNIQUE INDEX ix_users_username ON users(username, mail_host);
  67. --
  68. -- Table structure for table session
  69. --
  70. CREATE TABLE session (
  71. sess_id varchar(128) NOT NULL PRIMARY KEY,
  72. changed datetime NOT NULL default '0000-00-00 00:00:00',
  73. ip varchar(40) NOT NULL default '',
  74. vars text NOT NULL
  75. );
  76. CREATE INDEX ix_session_changed ON session (changed);
  77. --
  78. -- Table structure for table dictionary
  79. --
  80. CREATE TABLE dictionary (
  81. user_id integer DEFAULT NULL,
  82. "language" varchar(5) NOT NULL,
  83. data text NOT NULL
  84. );
  85. CREATE UNIQUE INDEX ix_dictionary_user_language ON dictionary (user_id, "language");
  86. --
  87. -- Table structure for table searches
  88. --
  89. CREATE TABLE searches (
  90. search_id integer NOT NULL PRIMARY KEY,
  91. user_id integer NOT NULL DEFAULT '0',
  92. "type" smallint NOT NULL DEFAULT '0',
  93. name varchar(128) NOT NULL,
  94. data text NOT NULL
  95. );
  96. CREATE UNIQUE INDEX ix_searches_user_type_name ON searches (user_id, type, name);
  97. --
  98. -- Table structure for table cache
  99. --
  100. CREATE TABLE cache (
  101. user_id integer NOT NULL default 0,
  102. cache_key varchar(128) NOT NULL default '',
  103. expires datetime DEFAULT NULL,
  104. data text NOT NULL,
  105. PRIMARY KEY (user_id, cache_key)
  106. );
  107. CREATE INDEX ix_cache_expires ON cache(expires);
  108. --
  109. -- Table structure for table cache_shared
  110. --
  111. CREATE TABLE cache_shared (
  112. cache_key varchar(255) NOT NULL,
  113. expires datetime DEFAULT NULL,
  114. data text NOT NULL,
  115. PRIMARY KEY (cache_key)
  116. );
  117. CREATE INDEX ix_cache_shared_expires ON cache_shared(expires);
  118. --
  119. -- Table structure for table cache_index
  120. --
  121. CREATE TABLE cache_index (
  122. user_id integer NOT NULL,
  123. mailbox varchar(255) NOT NULL,
  124. expires datetime DEFAULT NULL,
  125. valid smallint NOT NULL DEFAULT '0',
  126. data text NOT NULL,
  127. PRIMARY KEY (user_id, mailbox)
  128. );
  129. CREATE INDEX ix_cache_index_expires ON cache_index (expires);
  130. --
  131. -- Table structure for table cache_thread
  132. --
  133. CREATE TABLE cache_thread (
  134. user_id integer NOT NULL,
  135. mailbox varchar(255) NOT NULL,
  136. expires datetime DEFAULT NULL,
  137. data text NOT NULL,
  138. PRIMARY KEY (user_id, mailbox)
  139. );
  140. CREATE INDEX ix_cache_thread_expires ON cache_thread (expires);
  141. --
  142. -- Table structure for table cache_messages
  143. --
  144. CREATE TABLE cache_messages (
  145. user_id integer NOT NULL,
  146. mailbox varchar(255) NOT NULL,
  147. uid integer NOT NULL,
  148. expires datetime DEFAULT NULL,
  149. data text NOT NULL,
  150. flags integer NOT NULL DEFAULT '0',
  151. PRIMARY KEY (user_id, mailbox, uid)
  152. );
  153. CREATE INDEX ix_cache_messages_expires ON cache_messages (expires);
  154. --
  155. -- Table structure for table system
  156. --
  157. CREATE TABLE system (
  158. name varchar(64) NOT NULL PRIMARY KEY,
  159. value text NOT NULL
  160. );
  161. INSERT INTO system (name, value) VALUES ('roundcube-version', '2016112200');