3 -- Name: user_ids; Type: SEQUENCE; Schema: public; Owner: postgres
6 CREATE SEQUENCE user_ids
14 -- Name: users; Type: TABLE; Schema: public; Owner: postgres
18 user_id integer DEFAULT nextval('user_ids'::text) PRIMARY KEY,
19 username character varying(128) DEFAULT ''::character varying NOT NULL,
20 mail_host character varying(128) DEFAULT ''::character varying NOT NULL,
21 alias character varying(128) DEFAULT ''::character varying NOT NULL,
22 created timestamp with time zone DEFAULT now() NOT NULL,
23 last_login timestamp with time zone DEFAULT now() NOT NULL,
24 "language" character varying(5) DEFAULT 'en'::character varying NOT NULL,
25 preferences text DEFAULT ''::text NOT NULL
31 -- Name: session; Type: TABLE; Schema: public; Owner: postgres
34 CREATE TABLE "session" (
35 sess_id character varying(40) DEFAULT ''::character varying PRIMARY KEY,
36 created timestamp with time zone DEFAULT now() NOT NULL,
37 changed timestamp with time zone DEFAULT now() NOT NULL,
38 ip character varying(41) NOT NULL,
45 -- Sequence "identity_ids"
46 -- Name: identity_ids; Type: SEQUENCE; Schema: public; Owner: postgres
49 CREATE SEQUENCE identity_ids
58 -- Name: identities; Type: TABLE; Schema: public; Owner: postgres
61 CREATE TABLE identities (
62 identity_id integer DEFAULT nextval('identity_ids'::text) PRIMARY KEY,
63 user_id integer NOT NULL REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,
64 del integer DEFAULT 0 NOT NULL,
65 standard integer DEFAULT 0 NOT NULL,
66 name character varying(128) NOT NULL,
67 organization character varying(128),
68 email character varying(128) NOT NULL,
69 "reply-to" character varying(128),
70 bcc character varying(128),
72 html_signature integer DEFAULT 0 NOT NULL
75 CREATE INDEX identities_user_id_idx ON identities (user_id);
79 -- Sequence "contact_ids"
80 -- Name: contact_ids; Type: SEQUENCE; Schema: public; Owner: postgres
83 CREATE SEQUENCE contact_ids
92 -- Name: contacts; Type: TABLE; Schema: public; Owner: postgres
95 CREATE TABLE contacts (
96 contact_id integer DEFAULT nextval('contact_ids'::text) PRIMARY KEY,
97 user_id integer NOT NULL REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,
98 changed timestamp with time zone DEFAULT now() NOT NULL,
99 del integer DEFAULT 0 NOT NULL,
100 name character varying(128) DEFAULT ''::character varying NOT NULL,
101 email character varying(128) DEFAULT ''::character varying NOT NULL,
102 firstname character varying(128) DEFAULT ''::character varying NOT NULL,
103 surname character varying(128) DEFAULT ''::character varying NOT NULL,
107 CREATE INDEX contacts_user_id_idx ON contacts (user_id);
110 -- Sequence "cache_ids"
111 -- Name: cache_ids; Type: SEQUENCE; Schema: public; Owner: postgres
114 CREATE SEQUENCE cache_ids
122 -- Name: cache; Type: TABLE; Schema: public; Owner: postgres
125 CREATE TABLE "cache" (
126 cache_id integer DEFAULT nextval('cache_ids'::text) PRIMARY KEY,
127 user_id integer NOT NULL REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,
128 session_id character varying(40) REFERENCES "session" (sess_id),
129 cache_key character varying(128) DEFAULT ''::character varying NOT NULL,
130 created timestamp with time zone DEFAULT now() NOT NULL,
134 CREATE INDEX cache_user_id_idx ON "cache" (user_id, cache_key);
137 -- Sequence "message_ids"
138 -- Name: message_ids; Type: SEQUENCE; Schema: public; Owner: postgres
141 CREATE SEQUENCE message_ids
149 -- Name: messages; Type: TABLE; Schema: public; Owner: postgres
152 CREATE TABLE "messages" (
153 message_id integer DEFAULT nextval('message_ids'::text) PRIMARY KEY,
154 user_id integer NOT NULL REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,
155 del integer DEFAULT 0 NOT NULL,
156 cache_key character varying(128) DEFAULT ''::character varying NOT NULL,
157 created timestamp with time zone DEFAULT now() NOT NULL,
158 idx integer DEFAULT 0 NOT NULL,
159 uid integer DEFAULT 0 NOT NULL,
160 subject character varying(128) DEFAULT ''::character varying NOT NULL,
161 "from" character varying(128) DEFAULT ''::character varying NOT NULL,
162 "to" character varying(128) DEFAULT ''::character varying NOT NULL,
163 cc character varying(128) DEFAULT ''::character varying NOT NULL,
164 date timestamp with time zone NOT NULL,
165 size integer DEFAULT 0 NOT NULL,
166 headers text NOT NULL,
170 ALTER TABLE "messages" ADD UNIQUE (user_id, cache_key, uid);