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.

01_init.sql 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865
  1. --
  2. -- PostgreSQL database dump
  3. --
  4. -- Dumped from database version 9.6.0
  5. -- Dumped by pg_dump version 9.6.0
  6. SET statement_timeout = 0;
  7. SET lock_timeout = 0;
  8. SET idle_in_transaction_session_timeout = 0;
  9. SET client_encoding = 'UTF8';
  10. SET standard_conforming_strings = on;
  11. SET check_function_bodies = false;
  12. SET client_min_messages = warning;
  13. SET row_security = off;
  14. --
  15. -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
  16. --
  17. CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
  18. --
  19. -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
  20. --
  21. COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
  22. SET search_path = public, pg_catalog;
  23. --
  24. -- Name: merge_quota(); Type: FUNCTION; Schema: public; Owner: postfixadmin
  25. --
  26. CREATE FUNCTION merge_quota() RETURNS trigger
  27. LANGUAGE plpgsql
  28. AS $$
  29. BEGIN
  30. UPDATE quota SET current = NEW.current + current WHERE username = NEW.username AND path = NEW.path;
  31. IF found THEN
  32. RETURN NULL;
  33. ELSE
  34. RETURN NEW;
  35. END IF;
  36. END;
  37. $$;
  38. ALTER FUNCTION public.merge_quota() OWNER TO postfixadmin;
  39. --
  40. -- Name: merge_quota2(); Type: FUNCTION; Schema: public; Owner: postfixadmin
  41. --
  42. CREATE FUNCTION merge_quota2() RETURNS trigger
  43. LANGUAGE plpgsql
  44. AS $$
  45. BEGIN
  46. IF NEW.messages < 0 OR NEW.messages IS NULL THEN
  47. -- ugly kludge: we came here from this function, really do try to insert
  48. IF NEW.messages IS NULL THEN
  49. NEW.messages = 0;
  50. ELSE
  51. NEW.messages = -NEW.messages;
  52. END IF;
  53. return NEW;
  54. END IF;
  55. LOOP
  56. UPDATE quota2 SET bytes = bytes + NEW.bytes,
  57. messages = messages + NEW.messages
  58. WHERE username = NEW.username;
  59. IF found THEN
  60. RETURN NULL;
  61. END IF;
  62. BEGIN
  63. IF NEW.messages = 0 THEN
  64. INSERT INTO quota2 (bytes, messages, username) VALUES (NEW.bytes, NULL, NEW.username);
  65. ELSE
  66. INSERT INTO quota2 (bytes, messages, username) VALUES (NEW.bytes, -NEW.messages, NEW.username);
  67. END IF;
  68. return NULL;
  69. EXCEPTION WHEN unique_violation THEN
  70. -- someone just inserted the record, update it
  71. END;
  72. END LOOP;
  73. END;
  74. $$;
  75. ALTER FUNCTION public.merge_quota2() OWNER TO postfixadmin;
  76. SET default_tablespace = '';
  77. SET default_with_oids = false;
  78. --
  79. -- Name: admin; Type: TABLE; Schema: public; Owner: postfixadmin
  80. --
  81. CREATE TABLE admin (
  82. username character varying(255) NOT NULL,
  83. password character varying(255) DEFAULT ''::character varying NOT NULL,
  84. created timestamp with time zone DEFAULT now(),
  85. modified timestamp with time zone DEFAULT now(),
  86. active boolean DEFAULT true NOT NULL,
  87. superadmin boolean DEFAULT false NOT NULL
  88. );
  89. ALTER TABLE admin OWNER TO postfixadmin;
  90. --
  91. -- Name: TABLE admin; Type: COMMENT; Schema: public; Owner: postfixadmin
  92. --
  93. COMMENT ON TABLE admin IS 'Postfix Admin - Virtual Admins';
  94. --
  95. -- Name: alias; Type: TABLE; Schema: public; Owner: postfixadmin
  96. --
  97. CREATE TABLE alias (
  98. address character varying(255) NOT NULL,
  99. goto text NOT NULL,
  100. domain character varying(255) NOT NULL,
  101. created timestamp with time zone DEFAULT now(),
  102. modified timestamp with time zone DEFAULT now(),
  103. active boolean DEFAULT true NOT NULL,
  104. is_regexp boolean DEFAULT false NOT NULL
  105. );
  106. ALTER TABLE alias OWNER TO postfixadmin;
  107. --
  108. -- Name: TABLE alias; Type: COMMENT; Schema: public; Owner: postfixadmin
  109. --
  110. COMMENT ON TABLE alias IS 'Postfix Admin - Virtual Aliases';
  111. --
  112. -- Name: alias_domain; Type: TABLE; Schema: public; Owner: postfixadmin
  113. --
  114. CREATE TABLE alias_domain (
  115. alias_domain character varying(255) NOT NULL,
  116. target_domain character varying(255) NOT NULL,
  117. created timestamp with time zone DEFAULT now(),
  118. modified timestamp with time zone DEFAULT now(),
  119. active boolean DEFAULT true NOT NULL
  120. );
  121. ALTER TABLE alias_domain OWNER TO postfixadmin;
  122. --
  123. -- Name: TABLE alias_domain; Type: COMMENT; Schema: public; Owner: postfixadmin
  124. --
  125. COMMENT ON TABLE alias_domain IS 'Postfix Admin - Domain Aliases';
  126. --
  127. -- Name: config; Type: TABLE; Schema: public; Owner: postfixadmin
  128. --
  129. CREATE TABLE config (
  130. id integer NOT NULL,
  131. name character varying(20) NOT NULL,
  132. value character varying(20) NOT NULL
  133. );
  134. ALTER TABLE config OWNER TO postfixadmin;
  135. --
  136. -- Name: config_id_seq; Type: SEQUENCE; Schema: public; Owner: postfixadmin
  137. --
  138. CREATE SEQUENCE config_id_seq
  139. START WITH 1
  140. INCREMENT BY 1
  141. NO MINVALUE
  142. NO MAXVALUE
  143. CACHE 1;
  144. ALTER TABLE config_id_seq OWNER TO postfixadmin;
  145. --
  146. -- Name: config_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postfixadmin
  147. --
  148. ALTER SEQUENCE config_id_seq OWNED BY config.id;
  149. --
  150. -- Name: domain; Type: TABLE; Schema: public; Owner: postfixadmin
  151. --
  152. CREATE TABLE domain (
  153. domain character varying(255) NOT NULL,
  154. description character varying(255) DEFAULT ''::character varying NOT NULL,
  155. aliases integer DEFAULT 0 NOT NULL,
  156. mailboxes integer DEFAULT 0 NOT NULL,
  157. maxquota bigint DEFAULT 0 NOT NULL,
  158. quota bigint DEFAULT 0 NOT NULL,
  159. transport character varying(255) DEFAULT NULL::character varying,
  160. backupmx boolean DEFAULT false NOT NULL,
  161. created timestamp with time zone DEFAULT now(),
  162. modified timestamp with time zone DEFAULT now(),
  163. active boolean DEFAULT true NOT NULL
  164. );
  165. ALTER TABLE domain OWNER TO postfixadmin;
  166. --
  167. -- Name: TABLE domain; Type: COMMENT; Schema: public; Owner: postfixadmin
  168. --
  169. COMMENT ON TABLE domain IS 'Postfix Admin - Virtual Domains';
  170. --
  171. -- Name: domain_admins; Type: TABLE; Schema: public; Owner: postfixadmin
  172. --
  173. CREATE TABLE domain_admins (
  174. username character varying(255) NOT NULL,
  175. domain character varying(255) NOT NULL,
  176. created timestamp with time zone DEFAULT now(),
  177. active boolean DEFAULT true NOT NULL
  178. );
  179. ALTER TABLE domain_admins OWNER TO postfixadmin;
  180. --
  181. -- Name: TABLE domain_admins; Type: COMMENT; Schema: public; Owner: postfixadmin
  182. --
  183. COMMENT ON TABLE domain_admins IS 'Postfix Admin - Domain Admins';
  184. --
  185. -- Name: fetchmail; Type: TABLE; Schema: public; Owner: postfixadmin
  186. --
  187. CREATE TABLE fetchmail (
  188. id integer NOT NULL,
  189. mailbox character varying(255) DEFAULT ''::character varying NOT NULL,
  190. src_server character varying(255) DEFAULT ''::character varying NOT NULL,
  191. src_auth character varying(15) NOT NULL,
  192. src_user character varying(255) DEFAULT ''::character varying NOT NULL,
  193. src_password character varying(255) DEFAULT ''::character varying NOT NULL,
  194. src_folder character varying(255) DEFAULT ''::character varying NOT NULL,
  195. poll_time integer DEFAULT 10 NOT NULL,
  196. fetchall boolean DEFAULT false NOT NULL,
  197. keep boolean DEFAULT false NOT NULL,
  198. protocol character varying(15) NOT NULL,
  199. extra_options text,
  200. returned_text text,
  201. mda character varying(255) DEFAULT ''::character varying NOT NULL,
  202. date timestamp with time zone DEFAULT now(),
  203. usessl boolean DEFAULT false NOT NULL,
  204. sslcertck boolean DEFAULT false NOT NULL,
  205. sslcertpath character varying(255) DEFAULT ''::character varying,
  206. sslfingerprint character varying(255) DEFAULT ''::character varying,
  207. domain character varying(255) DEFAULT ''::character varying,
  208. active boolean DEFAULT false NOT NULL,
  209. created timestamp with time zone DEFAULT '2000-01-01 00:00:00+00'::timestamp with time zone,
  210. modified timestamp with time zone DEFAULT now(),
  211. CONSTRAINT fetchmail_protocol_check CHECK (((protocol)::text = ANY (ARRAY[('POP3'::character varying)::text, ('IMAP'::character varying)::text, ('POP2'::character varying)::text, ('ETRN'::character varying)::text, ('AUTO'::character varying)::text]))),
  212. CONSTRAINT fetchmail_src_auth_check CHECK (((src_auth)::text = ANY (ARRAY[('password'::character varying)::text, ('kerberos_v5'::character varying)::text, ('kerberos'::character varying)::text, ('kerberos_v4'::character varying)::text, ('gssapi'::character varying)::text, ('cram-md5'::character varying)::text, ('otp'::character varying)::text, ('ntlm'::character varying)::text, ('msn'::character varying)::text, ('ssh'::character varying)::text, ('any'::character varying)::text])))
  213. );
  214. ALTER TABLE fetchmail OWNER TO postfixadmin;
  215. --
  216. -- Name: fetchmail_id_seq; Type: SEQUENCE; Schema: public; Owner: postfixadmin
  217. --
  218. CREATE SEQUENCE fetchmail_id_seq
  219. START WITH 1
  220. INCREMENT BY 1
  221. NO MINVALUE
  222. NO MAXVALUE
  223. CACHE 1;
  224. ALTER TABLE fetchmail_id_seq OWNER TO postfixadmin;
  225. --
  226. -- Name: fetchmail_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postfixadmin
  227. --
  228. ALTER SEQUENCE fetchmail_id_seq OWNED BY fetchmail.id;
  229. --
  230. -- Name: log; Type: TABLE; Schema: public; Owner: postfixadmin
  231. --
  232. CREATE TABLE log (
  233. "timestamp" timestamp with time zone DEFAULT now(),
  234. username character varying(255) DEFAULT ''::character varying NOT NULL,
  235. domain character varying(255) DEFAULT ''::character varying NOT NULL,
  236. action character varying(255) DEFAULT ''::character varying NOT NULL,
  237. data text DEFAULT ''::text NOT NULL
  238. );
  239. ALTER TABLE log OWNER TO postfixadmin;
  240. --
  241. -- Name: TABLE log; Type: COMMENT; Schema: public; Owner: postfixadmin
  242. --
  243. COMMENT ON TABLE log IS 'Postfix Admin - Log';
  244. --
  245. -- Name: mailbox; Type: TABLE; Schema: public; Owner: postfixadmin
  246. --
  247. CREATE TABLE mailbox (
  248. username character varying(255) NOT NULL,
  249. password character varying(255) DEFAULT ''::character varying NOT NULL,
  250. name character varying(255) DEFAULT ''::character varying NOT NULL,
  251. maildir character varying(255) DEFAULT ''::character varying NOT NULL,
  252. quota bigint DEFAULT 0 NOT NULL,
  253. created timestamp with time zone DEFAULT now(),
  254. modified timestamp with time zone DEFAULT now(),
  255. active boolean DEFAULT true NOT NULL,
  256. domain character varying(255),
  257. local_part character varying(255) NOT NULL
  258. );
  259. ALTER TABLE mailbox OWNER TO postfixadmin;
  260. --
  261. -- Name: TABLE mailbox; Type: COMMENT; Schema: public; Owner: postfixadmin
  262. --
  263. COMMENT ON TABLE mailbox IS 'Postfix Admin - Virtual Mailboxes';
  264. --
  265. -- Name: quota; Type: TABLE; Schema: public; Owner: postfixadmin
  266. --
  267. CREATE TABLE quota (
  268. username character varying(255) NOT NULL,
  269. path character varying(100) NOT NULL,
  270. current bigint DEFAULT 0 NOT NULL
  271. );
  272. ALTER TABLE quota OWNER TO postfixadmin;
  273. --
  274. -- Name: quota2; Type: TABLE; Schema: public; Owner: postfixadmin
  275. --
  276. CREATE TABLE quota2 (
  277. username character varying(100) NOT NULL,
  278. bytes bigint DEFAULT 0 NOT NULL,
  279. messages integer DEFAULT 0 NOT NULL
  280. );
  281. ALTER TABLE quota2 OWNER TO postfixadmin;
  282. --
  283. -- Name: vacation; Type: TABLE; Schema: public; Owner: postfixadmin
  284. --
  285. CREATE TABLE vacation (
  286. email character varying(255) NOT NULL,
  287. subject character varying(255) NOT NULL,
  288. body text DEFAULT ''::text NOT NULL,
  289. created timestamp with time zone DEFAULT now(),
  290. active boolean DEFAULT true NOT NULL,
  291. domain character varying(255),
  292. modified timestamp with time zone DEFAULT now(),
  293. activefrom timestamp with time zone DEFAULT '2000-01-01 00:00:00+00'::timestamp with time zone,
  294. activeuntil timestamp with time zone DEFAULT '2000-01-01 00:00:00+00'::timestamp with time zone,
  295. interval_time integer DEFAULT 0 NOT NULL
  296. );
  297. ALTER TABLE vacation OWNER TO postfixadmin;
  298. --
  299. -- Name: vacation_notification; Type: TABLE; Schema: public; Owner: postfixadmin
  300. --
  301. CREATE TABLE vacation_notification (
  302. on_vacation character varying(255) NOT NULL,
  303. notified character varying(255) NOT NULL,
  304. notified_at timestamp with time zone DEFAULT now() NOT NULL
  305. );
  306. ALTER TABLE vacation_notification OWNER TO postfixadmin;
  307. --
  308. -- Name: config id; Type: DEFAULT; Schema: public; Owner: postfixadmin
  309. --
  310. ALTER TABLE ONLY config ALTER COLUMN id SET DEFAULT nextval('config_id_seq'::regclass);
  311. --
  312. -- Name: fetchmail id; Type: DEFAULT; Schema: public; Owner: postfixadmin
  313. --
  314. ALTER TABLE ONLY fetchmail ALTER COLUMN id SET DEFAULT nextval('fetchmail_id_seq'::regclass);
  315. --
  316. -- Data for Name: admin; Type: TABLE DATA; Schema: public; Owner: postfixadmin
  317. --
  318. COPY admin (username, password, created, modified, active, superadmin) FROM stdin;
  319. root@example.org $1$08010043$C3zWJJjhAu7RKuRjCN3qs0 2016-10-30 05:07:37.934434+00 2016-10-30 05:07:37.934434+00 t t
  320. \.
  321. --
  322. -- Data for Name: alias; Type: TABLE DATA; Schema: public; Owner: postfixadmin
  323. --
  324. COPY alias (address, goto, domain, created, modified, active, is_regexp) FROM stdin;
  325. \.
  326. --
  327. -- Data for Name: alias_domain; Type: TABLE DATA; Schema: public; Owner: postfixadmin
  328. --
  329. COPY alias_domain (alias_domain, target_domain, created, modified, active) FROM stdin;
  330. \.
  331. --
  332. -- Data for Name: config; Type: TABLE DATA; Schema: public; Owner: postfixadmin
  333. --
  334. COPY config (id, name, value) FROM stdin;
  335. 1 version 1835
  336. \.
  337. --
  338. -- Name: config_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postfixadmin
  339. --
  340. SELECT pg_catalog.setval('config_id_seq', 33, true);
  341. --
  342. -- Data for Name: domain; Type: TABLE DATA; Schema: public; Owner: postfixadmin
  343. --
  344. COPY domain (domain, description, aliases, mailboxes, maxquota, quota, transport, backupmx, created, modified, active) FROM stdin;
  345. ALL 0 0 0 0 f 2016-10-30 05:07:25.596851+00 2016-10-30 05:07:25.596851+00 t
  346. \.
  347. --
  348. -- Data for Name: domain_admins; Type: TABLE DATA; Schema: public; Owner: postfixadmin
  349. --
  350. COPY domain_admins (username, domain, created, active) FROM stdin;
  351. root@example.org ALL 2016-10-30 05:07:37.94995+00 t
  352. \.
  353. --
  354. -- Data for Name: fetchmail; Type: TABLE DATA; Schema: public; Owner: postfixadmin
  355. --
  356. COPY fetchmail (id, mailbox, src_server, src_auth, src_user, src_password, src_folder, poll_time, fetchall, keep, protocol, extra_options, returned_text, mda, date, usessl, sslcertck, sslcertpath, sslfingerprint, domain, active, created, modified) FROM stdin;
  357. \.
  358. --
  359. -- Name: fetchmail_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postfixadmin
  360. --
  361. SELECT pg_catalog.setval('fetchmail_id_seq', 33, true);
  362. --
  363. -- Data for Name: log; Type: TABLE DATA; Schema: public; Owner: postfixadmin
  364. --
  365. COPY log ("timestamp", username, domain, action, data) FROM stdin;
  366. 2016-10-30 05:07:37.963142+00 SETUP.PHP (192.168.56.1) create_admin root@example.org
  367. \.
  368. --
  369. -- Data for Name: mailbox; Type: TABLE DATA; Schema: public; Owner: postfixadmin
  370. --
  371. COPY mailbox (username, password, name, maildir, quota, created, modified, active, domain, local_part) FROM stdin;
  372. \.
  373. --
  374. -- Data for Name: quota; Type: TABLE DATA; Schema: public; Owner: postfixadmin
  375. --
  376. COPY quota (username, path, current) FROM stdin;
  377. \.
  378. --
  379. -- Data for Name: quota2; Type: TABLE DATA; Schema: public; Owner: postfixadmin
  380. --
  381. COPY quota2 (username, bytes, messages) FROM stdin;
  382. \.
  383. --
  384. -- Data for Name: vacation; Type: TABLE DATA; Schema: public; Owner: postfixadmin
  385. --
  386. COPY vacation (email, subject, body, created, active, domain, modified, activefrom, activeuntil, interval_time) FROM stdin;
  387. \.
  388. --
  389. -- Data for Name: vacation_notification; Type: TABLE DATA; Schema: public; Owner: postfixadmin
  390. --
  391. COPY vacation_notification (on_vacation, notified, notified_at) FROM stdin;
  392. \.
  393. --
  394. -- Name: admin admin_key; Type: CONSTRAINT; Schema: public; Owner: postfixadmin
  395. --
  396. ALTER TABLE ONLY admin
  397. ADD CONSTRAINT admin_key PRIMARY KEY (username);
  398. --
  399. -- Name: alias_domain alias_domain_pkey; Type: CONSTRAINT; Schema: public; Owner: postfixadmin
  400. --
  401. ALTER TABLE ONLY alias_domain
  402. ADD CONSTRAINT alias_domain_pkey PRIMARY KEY (alias_domain);
  403. --
  404. -- Name: alias alias_key; Type: CONSTRAINT; Schema: public; Owner: postfixadmin
  405. --
  406. ALTER TABLE ONLY alias
  407. ADD CONSTRAINT alias_key PRIMARY KEY (address);
  408. --
  409. -- Name: config config_name_key; Type: CONSTRAINT; Schema: public; Owner: postfixadmin
  410. --
  411. ALTER TABLE ONLY config
  412. ADD CONSTRAINT config_name_key UNIQUE (name);
  413. --
  414. -- Name: config config_pkey; Type: CONSTRAINT; Schema: public; Owner: postfixadmin
  415. --
  416. ALTER TABLE ONLY config
  417. ADD CONSTRAINT config_pkey PRIMARY KEY (id);
  418. --
  419. -- Name: domain domain_key; Type: CONSTRAINT; Schema: public; Owner: postfixadmin
  420. --
  421. ALTER TABLE ONLY domain
  422. ADD CONSTRAINT domain_key PRIMARY KEY (domain);
  423. --
  424. -- Name: fetchmail fetchmail_pkey; Type: CONSTRAINT; Schema: public; Owner: postfixadmin
  425. --
  426. ALTER TABLE ONLY fetchmail
  427. ADD CONSTRAINT fetchmail_pkey PRIMARY KEY (id);
  428. --
  429. -- Name: mailbox mailbox_key; Type: CONSTRAINT; Schema: public; Owner: postfixadmin
  430. --
  431. ALTER TABLE ONLY mailbox
  432. ADD CONSTRAINT mailbox_key PRIMARY KEY (username);
  433. --
  434. -- Name: quota2 quota2_pkey; Type: CONSTRAINT; Schema: public; Owner: postfixadmin
  435. --
  436. ALTER TABLE ONLY quota2
  437. ADD CONSTRAINT quota2_pkey PRIMARY KEY (username);
  438. --
  439. -- Name: quota quota_pkey; Type: CONSTRAINT; Schema: public; Owner: postfixadmin
  440. --
  441. ALTER TABLE ONLY quota
  442. ADD CONSTRAINT quota_pkey PRIMARY KEY (username, path);
  443. --
  444. -- Name: vacation_notification vacation_notification_pkey; Type: CONSTRAINT; Schema: public; Owner: postfixadmin
  445. --
  446. ALTER TABLE ONLY vacation_notification
  447. ADD CONSTRAINT vacation_notification_pkey PRIMARY KEY (on_vacation, notified);
  448. --
  449. -- Name: vacation vacation_pkey; Type: CONSTRAINT; Schema: public; Owner: postfixadmin
  450. --
  451. ALTER TABLE ONLY vacation
  452. ADD CONSTRAINT vacation_pkey PRIMARY KEY (email);
  453. --
  454. -- Name: alias_address_active; Type: INDEX; Schema: public; Owner: postfixadmin
  455. --
  456. CREATE INDEX alias_address_active ON alias USING btree (address, active);
  457. --
  458. -- Name: alias_domain_active; Type: INDEX; Schema: public; Owner: postfixadmin
  459. --
  460. CREATE INDEX alias_domain_active ON alias_domain USING btree (alias_domain, active);
  461. --
  462. -- Name: alias_domain_idx; Type: INDEX; Schema: public; Owner: postfixadmin
  463. --
  464. CREATE INDEX alias_domain_idx ON alias USING btree (domain);
  465. --
  466. -- Name: domain_domain_active; Type: INDEX; Schema: public; Owner: postfixadmin
  467. --
  468. CREATE INDEX domain_domain_active ON domain USING btree (domain, active);
  469. --
  470. -- Name: log_domain_timestamp_idx; Type: INDEX; Schema: public; Owner: postfixadmin
  471. --
  472. CREATE INDEX log_domain_timestamp_idx ON log USING btree (domain, "timestamp");
  473. --
  474. -- Name: mailbox_domain_idx; Type: INDEX; Schema: public; Owner: postfixadmin
  475. --
  476. CREATE INDEX mailbox_domain_idx ON mailbox USING btree (domain);
  477. --
  478. -- Name: mailbox_username_active; Type: INDEX; Schema: public; Owner: postfixadmin
  479. --
  480. CREATE INDEX mailbox_username_active ON mailbox USING btree (username, active);
  481. --
  482. -- Name: vacation_email_active; Type: INDEX; Schema: public; Owner: postfixadmin
  483. --
  484. CREATE INDEX vacation_email_active ON vacation USING btree (email, active);
  485. --
  486. -- Name: quota mergequota; Type: TRIGGER; Schema: public; Owner: postfixadmin
  487. --
  488. CREATE TRIGGER mergequota BEFORE INSERT ON quota FOR EACH ROW EXECUTE PROCEDURE merge_quota();
  489. --
  490. -- Name: quota2 mergequota2; Type: TRIGGER; Schema: public; Owner: postfixadmin
  491. --
  492. CREATE TRIGGER mergequota2 BEFORE INSERT ON quota2 FOR EACH ROW EXECUTE PROCEDURE merge_quota2();
  493. --
  494. -- Name: alias_domain alias_domain_alias_domain_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postfixadmin
  495. --
  496. ALTER TABLE ONLY alias_domain
  497. ADD CONSTRAINT alias_domain_alias_domain_fkey FOREIGN KEY (alias_domain) REFERENCES domain(domain) ON DELETE CASCADE;
  498. --
  499. -- Name: alias alias_domain_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postfixadmin
  500. --
  501. ALTER TABLE ONLY alias
  502. ADD CONSTRAINT alias_domain_fkey FOREIGN KEY (domain) REFERENCES domain(domain);
  503. --
  504. -- Name: alias_domain alias_domain_target_domain_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postfixadmin
  505. --
  506. ALTER TABLE ONLY alias_domain
  507. ADD CONSTRAINT alias_domain_target_domain_fkey FOREIGN KEY (target_domain) REFERENCES domain(domain) ON DELETE CASCADE;
  508. --
  509. -- Name: domain_admins domain_admins_domain_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postfixadmin
  510. --
  511. ALTER TABLE ONLY domain_admins
  512. ADD CONSTRAINT domain_admins_domain_fkey FOREIGN KEY (domain) REFERENCES domain(domain);
  513. --
  514. -- Name: mailbox mailbox_domain_fkey1; Type: FK CONSTRAINT; Schema: public; Owner: postfixadmin
  515. --
  516. ALTER TABLE ONLY mailbox
  517. ADD CONSTRAINT mailbox_domain_fkey1 FOREIGN KEY (domain) REFERENCES domain(domain);
  518. --
  519. -- Name: vacation vacation_domain_fkey1; Type: FK CONSTRAINT; Schema: public; Owner: postfixadmin
  520. --
  521. ALTER TABLE ONLY vacation
  522. ADD CONSTRAINT vacation_domain_fkey1 FOREIGN KEY (domain) REFERENCES domain(domain);
  523. --
  524. -- Name: vacation_notification vacation_notification_on_vacation_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postfixadmin
  525. --
  526. ALTER TABLE ONLY vacation_notification
  527. ADD CONSTRAINT vacation_notification_on_vacation_fkey FOREIGN KEY (on_vacation) REFERENCES vacation(email) ON DELETE CASCADE;
  528. --
  529. -- Name: transport; Type: TABLE; Schema: public; Owner: postfixadmin; Tablespace:
  530. --
  531. CREATE TABLE transport (
  532. domain character varying(128) NOT NULL,
  533. transport character varying(128) NOT NULL
  534. );
  535. ALTER TABLE transport OWNER TO postfixadmin;
  536. --
  537. -- Name: transport_pkey; Type: CONSTRAINT; Schema: public; Owner: postfixadmin; Tablespace:
  538. --
  539. ALTER TABLE ONLY transport
  540. ADD CONSTRAINT transport_pkey PRIMARY KEY (domain);
  541. --
  542. -- Name: recipient_bcc; Type: TABLE; Schema: public; Owner: postfixadmin; Tablespace:
  543. --
  544. CREATE TABLE recipient_bcc (
  545. recipient character varying(128) NOT NULL,
  546. bcc character varying(128) NOT NULL
  547. );
  548. ALTER TABLE recipient_bcc OWNER TO postfixadmin;
  549. --
  550. -- Name: recipient_bcc_pkey; Type: CONSTRAINT; Schema: public; Owner: postfixadmin; Tablespace:
  551. --
  552. ALTER TABLE ONLY recipient_bcc
  553. ADD CONSTRAINT recipient_bcc_pkey PRIMARY KEY (recipient);
  554. CREATE TABLE dkim_external_ignore_list (
  555. host text NOT NULL
  556. );
  557. ALTER TABLE dkim_external_ignore_list OWNER TO dev;
  558. --
  559. -- Name: dkim_internal_hosts; Type: TABLE; Schema: public; Owner: dev; Tablespace:
  560. --
  561. CREATE TABLE dkim_internal_hosts (
  562. host text NOT NULL
  563. );
  564. ALTER TABLE dkim_internal_hosts OWNER TO dev;
  565. --
  566. -- Name: dkim_key_table; Type: TABLE; Schema: public; Owner: dev; Tablespace:
  567. --
  568. CREATE TABLE dkim_key_table (
  569. name text NOT NULL,
  570. key_path text NOT NULL
  571. );
  572. ALTER TABLE dkim_key_table OWNER TO dev;
  573. --
  574. -- Name: dkim_signing_table; Type: TABLE; Schema: public; Owner: dev; Tablespace:
  575. --
  576. CREATE TABLE dkim_signing_table (
  577. email text NOT NULL,
  578. name text NOT NULL
  579. );
  580. ALTER TABLE ONLY dkim_signing_table
  581. ADD CONSTRAINT dkim_signing_table_name_fkey FOREIGN KEY (name) REFERENCES dkim_key_table(name) ON UPDATE CASCADE ON DELETE CASCADE;
  582. --
  583. -- PostgreSQL database dump complete
  584. --