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.

sqlite.initial.sql 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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. created datetime NOT NULL default '0000-00-00 00:00:00',
  73. changed datetime NOT NULL default '0000-00-00 00:00:00',
  74. ip varchar(40) NOT NULL default '',
  75. vars text NOT NULL
  76. );
  77. CREATE INDEX ix_session_changed ON session (changed);
  78. --
  79. -- Table structure for table dictionary
  80. --
  81. CREATE TABLE dictionary (
  82. user_id integer DEFAULT NULL,
  83. "language" varchar(5) NOT NULL,
  84. data text NOT NULL
  85. );
  86. CREATE UNIQUE INDEX ix_dictionary_user_language ON dictionary (user_id, "language");
  87. --
  88. -- Table structure for table searches
  89. --
  90. CREATE TABLE searches (
  91. search_id integer NOT NULL PRIMARY KEY,
  92. user_id integer NOT NULL DEFAULT '0',
  93. "type" smallint NOT NULL DEFAULT '0',
  94. name varchar(128) NOT NULL,
  95. data text NOT NULL
  96. );
  97. CREATE UNIQUE INDEX ix_searches_user_type_name ON searches (user_id, type, name);
  98. --
  99. -- Table structure for table cache
  100. --
  101. CREATE TABLE cache (
  102. user_id integer NOT NULL default 0,
  103. cache_key varchar(128) NOT NULL default '',
  104. created datetime NOT NULL default '0000-00-00 00:00:00',
  105. expires datetime DEFAULT NULL,
  106. data text NOT NULL
  107. );
  108. CREATE INDEX ix_cache_user_cache_key ON cache(user_id, cache_key);
  109. CREATE INDEX ix_cache_expires ON cache(expires);
  110. --
  111. -- Table structure for table cache_shared
  112. --
  113. CREATE TABLE cache_shared (
  114. cache_key varchar(255) NOT NULL,
  115. created datetime NOT NULL default '0000-00-00 00:00:00',
  116. expires datetime DEFAULT NULL,
  117. data text NOT NULL
  118. );
  119. CREATE INDEX ix_cache_shared_cache_key ON cache_shared(cache_key);
  120. CREATE INDEX ix_cache_shared_expires ON cache_shared(expires);
  121. --
  122. -- Table structure for table cache_index
  123. --
  124. CREATE TABLE cache_index (
  125. user_id integer NOT NULL,
  126. mailbox varchar(255) NOT NULL,
  127. expires datetime DEFAULT NULL,
  128. valid smallint NOT NULL DEFAULT '0',
  129. data text NOT NULL,
  130. PRIMARY KEY (user_id, mailbox)
  131. );
  132. CREATE INDEX ix_cache_index_expires ON cache_index (expires);
  133. --
  134. -- Table structure for table cache_thread
  135. --
  136. CREATE TABLE cache_thread (
  137. user_id integer NOT NULL,
  138. mailbox varchar(255) NOT NULL,
  139. expires datetime DEFAULT NULL,
  140. data text NOT NULL,
  141. PRIMARY KEY (user_id, mailbox)
  142. );
  143. CREATE INDEX ix_cache_thread_expires ON cache_thread (expires);
  144. --
  145. -- Table structure for table cache_messages
  146. --
  147. CREATE TABLE cache_messages (
  148. user_id integer NOT NULL,
  149. mailbox varchar(255) NOT NULL,
  150. uid integer NOT NULL,
  151. expires datetime DEFAULT NULL,
  152. data text NOT NULL,
  153. flags integer NOT NULL DEFAULT '0',
  154. PRIMARY KEY (user_id, mailbox, uid)
  155. );
  156. CREATE INDEX ix_cache_messages_expires ON cache_messages (expires);
  157. --
  158. -- Table structure for table system
  159. --
  160. CREATE TABLE system (
  161. name varchar(64) NOT NULL PRIMARY KEY,
  162. value text NOT NULL
  163. );
  164. INSERT INTO system (name, value) VALUES ('roundcube-version', '2015111100');