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.

2011092800.sql 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. -- Updates from version 0.6
  2. CREATE TABLE dictionary (
  3. user_id integer DEFAULT NULL
  4. REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,
  5. "language" varchar(5) NOT NULL,
  6. data text NOT NULL,
  7. CONSTRAINT dictionary_user_id_language_key UNIQUE (user_id, "language")
  8. );
  9. CREATE SEQUENCE search_ids
  10. INCREMENT BY 1
  11. NO MAXVALUE
  12. NO MINVALUE
  13. CACHE 1;
  14. CREATE TABLE searches (
  15. search_id integer DEFAULT nextval('search_ids'::text) PRIMARY KEY,
  16. user_id integer NOT NULL
  17. REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,
  18. "type" smallint DEFAULT 0 NOT NULL,
  19. name varchar(128) NOT NULL,
  20. data text NOT NULL,
  21. CONSTRAINT searches_user_id_key UNIQUE (user_id, "type", name)
  22. );
  23. DROP SEQUENCE message_ids;
  24. DROP TABLE messages;
  25. CREATE TABLE cache_index (
  26. user_id integer NOT NULL
  27. REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,
  28. mailbox varchar(255) NOT NULL,
  29. changed timestamp with time zone DEFAULT now() NOT NULL,
  30. valid smallint NOT NULL DEFAULT 0,
  31. data text NOT NULL,
  32. PRIMARY KEY (user_id, mailbox)
  33. );
  34. CREATE INDEX cache_index_changed_idx ON cache_index (changed);
  35. CREATE TABLE cache_thread (
  36. user_id integer NOT NULL
  37. REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,
  38. mailbox varchar(255) NOT NULL,
  39. changed timestamp with time zone DEFAULT now() NOT NULL,
  40. data text NOT NULL,
  41. PRIMARY KEY (user_id, mailbox)
  42. );
  43. CREATE INDEX cache_thread_changed_idx ON cache_thread (changed);
  44. CREATE TABLE cache_messages (
  45. user_id integer NOT NULL
  46. REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,
  47. mailbox varchar(255) NOT NULL,
  48. uid integer NOT NULL,
  49. changed timestamp with time zone DEFAULT now() NOT NULL,
  50. data text NOT NULL,
  51. flags integer NOT NULL DEFAULT 0,
  52. PRIMARY KEY (user_id, mailbox, uid)
  53. );
  54. CREATE INDEX cache_messages_changed_idx ON cache_messages (changed);