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.

204 lines
5.2 KiB

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