ソースを参照

Updated postgres

tags/v2.0.0
Robin Thoni 5年前
コミット
350ff2d8ab

+ 0
- 0
postfixadmin/postfixadmin-3.0/templates_c/.gitkeep ファイルの表示


+ 7
- 2
postgresql/Dockerfile ファイルの表示

@@ -1,5 +1,10 @@
1
-FROM robinthoni/postgres-backup:9.6
1
+FROM postgres:11.2
2 2
 
3
-RUN rm -rf /var/log/*
3
+ADD https://raw.githubusercontent.com/docker-gcf/docker-gcf/v1.5.0/setup.sh /tmp/docker-utils-setup.sh
4
+RUN sh /tmp/docker-utils-setup.sh
5
+ENTRYPOINT ["gcf-entrypoint"]
6
+CMD ["run.sh"]
7
+
8
+COPY ./bin /usr/local/bin/
4 9
 
5 10
 COPY ./docker-entrypoint-initdb.d/ /docker-entrypoint-initdb.d

+ 7
- 0
postgresql/bin/run.sh ファイルの表示

@@ -0,0 +1,7 @@
1
+#! /bin/bash
2
+
3
+export POSTGRES_DB="$(cat /tmp/gcf-model.json | jq -r .model.postgres.database)"
4
+export POSTGRES_USER="$(cat /tmp/gcf-model.json | jq -r .model.postgres.user)"
5
+export POSTGRES_PASSWORD="$(cat /tmp/gcf-model.json | jq -r .model.postgres.password)"
6
+
7
+docker-entrypoint.sh postgres

+ 0
- 734
postgresql/docker-entrypoint-initdb.d/01_init.sql ファイルの表示

@@ -1,815 +0,0 @@
1
---
2
---
3
-
4
-
5
-SET statement_timeout = 0;
6
-SET lock_timeout = 0;
7
-SET idle_in_transaction_session_timeout = 0;
8
-SET client_encoding = 'UTF8';
9
-SET standard_conforming_strings = on;
10
-SET check_function_bodies = false;
11
-SET client_min_messages = warning;
12
-SET row_security = off;
13
-
14
---
15
---
16
-
17
-CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
18
-
19
-
20
---
21
---
22
-
23
-COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
24
-
25
-
26
-SET search_path = public, pg_catalog;
27
-
28
---
29
---
30
-
31
-CREATE FUNCTION merge_quota() RETURNS trigger
32
-    LANGUAGE plpgsql
33
-    AS $$

34
-        BEGIN

35
-            UPDATE quota SET current = NEW.current + current WHERE username = NEW.username AND path = NEW.path;

36
-            IF found THEN

37
-                RETURN NULL;

38
-            ELSE

39
-                RETURN NEW;

40
-            END IF;

41
-      END;

42
-      $$;
43
-
44
-
45
-ALTER FUNCTION public.merge_quota() OWNER TO postfixadmin;
46
-
47
---
48
---
49
-
50
-CREATE FUNCTION merge_quota2() RETURNS trigger
51
-    LANGUAGE plpgsql
52
-    AS $$

53
-        BEGIN

54
-            IF NEW.messages < 0 OR NEW.messages IS NULL THEN

55
-                -- ugly kludge: we came here from this function, really do try to insert

56
-                IF NEW.messages IS NULL THEN

57
-                    NEW.messages = 0;

58
-                ELSE

59
-                    NEW.messages = -NEW.messages;

60
-                END IF;

61
-                return NEW;

62
-            END IF;

63
-

64
-            LOOP

65
-                UPDATE quota2 SET bytes = bytes + NEW.bytes,

66
-                    messages = messages + NEW.messages

67
-                    WHERE username = NEW.username;

68
-                IF found THEN

69
-                    RETURN NULL;

70
-                END IF;

71
-

72
-                BEGIN

73
-                    IF NEW.messages = 0 THEN

74
-                    INSERT INTO quota2 (bytes, messages, username) VALUES (NEW.bytes, NULL, NEW.username);

75
-                    ELSE

76
-                        INSERT INTO quota2 (bytes, messages, username) VALUES (NEW.bytes, -NEW.messages, NEW.username);

77
-                    END IF;

78
-                    return NULL;

79
-                    EXCEPTION WHEN unique_violation THEN

80
-                    -- someone just inserted the record, update it

81
-                END;

82
-            END LOOP;

83
-        END;

84
-        $$;
85
-
86
-
87
-ALTER FUNCTION public.merge_quota2() OWNER TO postfixadmin;
88
-
89
-SET default_tablespace = '';
90
-
91
-SET default_with_oids = false;
92
-
93
---
94
---
95
-
96
-CREATE TABLE admin (
97
-    username character varying(255) NOT NULL,
98
-    password character varying(255) DEFAULT ''::character varying NOT NULL,
99
-    created timestamp with time zone DEFAULT now(),
100
-    modified timestamp with time zone DEFAULT now(),
101
-    active boolean DEFAULT true NOT NULL,
102
-    superadmin boolean DEFAULT false NOT NULL
103
-);
104
-
105
-
106
-ALTER TABLE admin OWNER TO postfixadmin;
107
-
108
---
109
---
110
-
111
-COMMENT ON TABLE admin IS 'Postfix Admin - Virtual Admins';
112
-
113
-
114
---
115
---
116
-
117
-CREATE TABLE alias (
118
-    address character varying(255) NOT NULL,
119
-    goto text NOT NULL,
120
-    domain character varying(255) NOT NULL,
121
-    created timestamp with time zone DEFAULT now(),
122
-    modified timestamp with time zone DEFAULT now(),
123
-    active boolean DEFAULT true NOT NULL,
124
-    is_regexp boolean DEFAULT false NOT NULL
125
-);
126
-
127
-
128
-ALTER TABLE alias OWNER TO postfixadmin;
129
-
130
---
131
---
132
-
133
-COMMENT ON TABLE alias IS 'Postfix Admin - Virtual Aliases';
134
-
135
-
136
---
137
---
138
-
139
-CREATE TABLE alias_domain (
140
-    alias_domain character varying(255) NOT NULL,
141
-    target_domain character varying(255) NOT NULL,
142
-    created timestamp with time zone DEFAULT now(),
143
-    modified timestamp with time zone DEFAULT now(),
144
-    active boolean DEFAULT true NOT NULL
145
-);
146
-
147
-
148
-ALTER TABLE alias_domain OWNER TO postfixadmin;
149
-
150
---
151
---
152
-
153
-COMMENT ON TABLE alias_domain IS 'Postfix Admin - Domain Aliases';
154
-
155
-
156
---
157
---
158
-
159
-CREATE TABLE config (
160
-    id integer NOT NULL,
161
-    name character varying(20) NOT NULL,
162
-    value character varying(20) NOT NULL
163
-);
164
-
165
-
166
-ALTER TABLE config OWNER TO postfixadmin;
167
-
168
---
169
---
170
-
171
-CREATE SEQUENCE config_id_seq
172
-    START WITH 1
173
-    INCREMENT BY 1
174
-    NO MINVALUE
175
-    NO MAXVALUE
176
-    CACHE 1;
177
-
178
-
179
-ALTER TABLE config_id_seq OWNER TO postfixadmin;
180
-
181
---
182
---
183
-
184
-ALTER SEQUENCE config_id_seq OWNED BY config.id;
185
-
186
-
187
---
188
---
189
-
190
-CREATE TABLE domain (
191
-    domain character varying(255) NOT NULL,
192
-    description character varying(255) DEFAULT ''::character varying NOT NULL,
193
-    aliases integer DEFAULT 0 NOT NULL,
194
-    mailboxes integer DEFAULT 0 NOT NULL,
195
-    maxquota bigint DEFAULT 0 NOT NULL,
196
-    quota bigint DEFAULT 0 NOT NULL,
197
-    transport character varying(255) DEFAULT NULL::character varying,
198
-    backupmx boolean DEFAULT false NOT NULL,
199
-    created timestamp with time zone DEFAULT now(),
200
-    modified timestamp with time zone DEFAULT now(),
201
-    active boolean DEFAULT true NOT NULL
202
-);
203
-
204
-
205
-ALTER TABLE domain OWNER TO postfixadmin;
206
-
207
---
208
---
209
-
210
-COMMENT ON TABLE domain IS 'Postfix Admin - Virtual Domains';
211
-
212
-
213
---
214
---
215
-
216
-CREATE TABLE domain_admins (
217
-    username character varying(255) NOT NULL,
218
-    domain character varying(255) NOT NULL,
219
-    created timestamp with time zone DEFAULT now(),
220
-    active boolean DEFAULT true NOT NULL
221
-);
222
-
223
-
224
-ALTER TABLE domain_admins OWNER TO postfixadmin;
225
-
226
---
227
---
228
-
229
-COMMENT ON TABLE domain_admins IS 'Postfix Admin - Domain Admins';
230
-
231
-
232
---
233
---
234
-
235
-CREATE TABLE fetchmail (
236
-    id integer NOT NULL,
237
-    mailbox character varying(255) DEFAULT ''::character varying NOT NULL,
238
-    src_server character varying(255) DEFAULT ''::character varying NOT NULL,
239
-    src_auth character varying(15) NOT NULL,
240
-    src_user character varying(255) DEFAULT ''::character varying NOT NULL,
241
-    src_password character varying(255) DEFAULT ''::character varying NOT NULL,
242
-    src_folder character varying(255) DEFAULT ''::character varying NOT NULL,
243
-    poll_time integer DEFAULT 10 NOT NULL,
244
-    fetchall boolean DEFAULT false NOT NULL,
245
-    keep boolean DEFAULT false NOT NULL,
246
-    protocol character varying(15) NOT NULL,
247
-    extra_options text,
248
-    returned_text text,
249
-    mda character varying(255) DEFAULT ''::character varying NOT NULL,
250
-    date timestamp with time zone DEFAULT now(),
251
-    usessl boolean DEFAULT false NOT NULL,
252
-    sslcertck boolean DEFAULT false NOT NULL,
253
-    sslcertpath character varying(255) DEFAULT ''::character varying,
254
-    sslfingerprint character varying(255) DEFAULT ''::character varying,
255
-    domain character varying(255) DEFAULT ''::character varying,
256
-    active boolean DEFAULT false NOT NULL,
257
-    created timestamp with time zone DEFAULT '2000-01-01 00:00:00+00'::timestamp with time zone,
258
-    modified timestamp with time zone DEFAULT now(),
259
-    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]))),
260
-    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])))
261
-);
262
-
263
-
264
-ALTER TABLE fetchmail OWNER TO postfixadmin;
265
-
266
---
267
---
268
-
269
-CREATE SEQUENCE fetchmail_id_seq
270
-    START WITH 1
271
-    INCREMENT BY 1
272
-    NO MINVALUE
273
-    NO MAXVALUE
274
-    CACHE 1;
275
-
276
-
277
-ALTER TABLE fetchmail_id_seq OWNER TO postfixadmin;
278
-
279
---
280
---
281
-
282
-ALTER SEQUENCE fetchmail_id_seq OWNED BY fetchmail.id;
283
-
284
-
285
---
286
---
287
-
288
-CREATE TABLE log (
289
-    "timestamp" timestamp with time zone DEFAULT now(),
290
-    username character varying(255) DEFAULT ''::character varying NOT NULL,
291
-    domain character varying(255) DEFAULT ''::character varying NOT NULL,
292
-    action character varying(255) DEFAULT ''::character varying NOT NULL,
293
-    data text DEFAULT ''::text NOT NULL
294
-);
295
-
296
-
297
-ALTER TABLE log OWNER TO postfixadmin;
298
-
299
---
300
---
301
-
302
-COMMENT ON TABLE log IS 'Postfix Admin - Log';
303
-
304
-
305
---
306
---
307
-
308
-CREATE TABLE mailbox (
309
-    username character varying(255) NOT NULL,
310
-    password character varying(255) DEFAULT ''::character varying NOT NULL,
311
-    name character varying(255) DEFAULT ''::character varying NOT NULL,
312
-    maildir character varying(255) DEFAULT ''::character varying NOT NULL,
313
-    quota bigint DEFAULT 0 NOT NULL,
314
-    created timestamp with time zone DEFAULT now(),
315
-    modified timestamp with time zone DEFAULT now(),
316
-    active boolean DEFAULT true NOT NULL,
317
-    domain character varying(255),
318
-    local_part character varying(255) NOT NULL
319
-);
320
-
321
-
322
-ALTER TABLE mailbox OWNER TO postfixadmin;
323
-
324
---
325
---
326
-
327
-COMMENT ON TABLE mailbox IS 'Postfix Admin - Virtual Mailboxes';
328
-
329
-
330
---
331
---
332
-
333
-CREATE TABLE quota (
334
-    username character varying(255) NOT NULL,
335
-    path character varying(100) NOT NULL,
336
-    current bigint DEFAULT 0 NOT NULL
337
-);
338
-
339
-
340
-ALTER TABLE quota OWNER TO postfixadmin;
341
-
342
---
343
---
344
-
345
-CREATE TABLE quota2 (
346
-    username character varying(100) NOT NULL,
347
-    bytes bigint DEFAULT 0 NOT NULL,
348
-    messages integer DEFAULT 0 NOT NULL
349
-);
350
-
351
-
352
-ALTER TABLE quota2 OWNER TO postfixadmin;
353
-
354
---
355
---
356
-
357
-CREATE TABLE vacation (
358
-    email character varying(255) NOT NULL,
359
-    subject character varying(255) NOT NULL,
360
-    body text DEFAULT ''::text NOT NULL,
361
-    created timestamp with time zone DEFAULT now(),
362
-    active boolean DEFAULT true NOT NULL,
363
-    domain character varying(255),
364
-    modified timestamp with time zone DEFAULT now(),
365
-    activefrom timestamp with time zone DEFAULT '2000-01-01 00:00:00+00'::timestamp with time zone,
366
-    activeuntil timestamp with time zone DEFAULT '2000-01-01 00:00:00+00'::timestamp with time zone,
367
-    interval_time integer DEFAULT 0 NOT NULL
368
-);
369
-
370
-
371
-ALTER TABLE vacation OWNER TO postfixadmin;
372
-
373
---
374
---
375
-
376
-CREATE TABLE vacation_notification (
377
-    on_vacation character varying(255) NOT NULL,
378
-    notified character varying(255) NOT NULL,
379
-    notified_at timestamp with time zone DEFAULT now() NOT NULL
380
-);
381
-
382
-
383
-ALTER TABLE vacation_notification OWNER TO postfixadmin;
384
-
385
---
386
---
387
-
388
-ALTER TABLE ONLY config ALTER COLUMN id SET DEFAULT nextval('config_id_seq'::regclass);
389
-
390
-
391
---
392
---
393
-
394
-ALTER TABLE ONLY fetchmail ALTER COLUMN id SET DEFAULT nextval('fetchmail_id_seq'::regclass);
395
-
396
-
397
---
398
---
399
-
400
-COPY admin (username, password, created, modified, active, superadmin) FROM stdin;
401
-root@example.org	$1$08010043$C3zWJJjhAu7RKuRjCN3qs0	2016-10-30 05:07:37.934434+00	2016-10-30 05:07:37.934434+00	t	t
402
-\.
403
-
404
-
405
---
406
---
407
-
408
-COPY alias (address, goto, domain, created, modified, active, is_regexp) FROM stdin;
409
-\.
410
-
411
-
412
---
413
---
414
-
415
-COPY alias_domain (alias_domain, target_domain, created, modified, active) FROM stdin;
416
-\.
417
-
418
-
419
---
420
---
421
-
422
-COPY config (id, name, value) FROM stdin;
423
-1	version	1835
424
-\.
425
-
426
-
427
---
428
---
429
-
430
-SELECT pg_catalog.setval('config_id_seq', 33, true);
431
-
432
-
433
---
434
---
435
-
436
-COPY domain (domain, description, aliases, mailboxes, maxquota, quota, transport, backupmx, created, modified, active) FROM stdin;
437
-ALL		0	0	0	0		f	2016-10-30 05:07:25.596851+00	2016-10-30 05:07:25.596851+00	t
438
-\.
439
-
440
-
441
---
442
---
443
-
444
-COPY domain_admins (username, domain, created, active) FROM stdin;
445
-root@example.org	ALL	2016-10-30 05:07:37.94995+00	t
446
-\.
447
-
448
-
449
---
450
---
451
-
452
-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;
453
-\.
454
-
455
-
456
---
457
---
458
-
459
-SELECT pg_catalog.setval('fetchmail_id_seq', 33, true);
460
-
461
-
462
---
463
---
464
-
465
-COPY log ("timestamp", username, domain, action, data) FROM stdin;
466
-2016-10-30 05:07:37.963142+00	SETUP.PHP (192.168.56.1)		create_admin	root@example.org
467
-\.
468
-
469
-
470
---
471
---
472
-
473
-COPY mailbox (username, password, name, maildir, quota, created, modified, active, domain, local_part) FROM stdin;
474
-\.
475
-
476
-
477
---
478
---
479
-
480
-COPY quota (username, path, current) FROM stdin;
481
-\.
482
-
483
-
484
---
485
---
486
-
487
-COPY quota2 (username, bytes, messages) FROM stdin;
488
-\.
489
-
490
-
491
---
492
---
493
-
494
-COPY vacation (email, subject, body, created, active, domain, modified, activefrom, activeuntil, interval_time) FROM stdin;
495
-\.
496
-
497
-
498
---
499
---
500
-
501
-COPY vacation_notification (on_vacation, notified, notified_at) FROM stdin;
502
-\.
503
-
504
-
505
---
506
---
507
-
508
-ALTER TABLE ONLY admin
509
-    ADD CONSTRAINT admin_key PRIMARY KEY (username);
510
-
511
-
512
---
513
---
514
-
515
-ALTER TABLE ONLY alias_domain
516
-    ADD CONSTRAINT alias_domain_pkey PRIMARY KEY (alias_domain);
517
-
518
-
519
---
520
---
521
-
522
-ALTER TABLE ONLY alias
523
-    ADD CONSTRAINT alias_key PRIMARY KEY (address);
524
-
525
-
526
---
527
---
528
-
529
-ALTER TABLE ONLY config
530
-    ADD CONSTRAINT config_name_key UNIQUE (name);
531
-
532
-
533
---
534
---
535
-
536
-ALTER TABLE ONLY config
537
-    ADD CONSTRAINT config_pkey PRIMARY KEY (id);
538
-
539
-
540
---
541
---
542
-
543
-ALTER TABLE ONLY domain
544
-    ADD CONSTRAINT domain_key PRIMARY KEY (domain);
545
-
546
-
547
---
548
---
549
-
550
-ALTER TABLE ONLY fetchmail
551
-    ADD CONSTRAINT fetchmail_pkey PRIMARY KEY (id);
552
-
553
-
554
---
555
---
556
-
557
-ALTER TABLE ONLY mailbox
558
-    ADD CONSTRAINT mailbox_key PRIMARY KEY (username);
559
-
560
-
561
---
562
---
563
-
564
-ALTER TABLE ONLY quota2
565
-    ADD CONSTRAINT quota2_pkey PRIMARY KEY (username);
566
-
567
-
568
---
569
---
570
-
571
-ALTER TABLE ONLY quota
572
-    ADD CONSTRAINT quota_pkey PRIMARY KEY (username, path);
573
-
574
-
575
---
576
---
577
-
578
-ALTER TABLE ONLY vacation_notification
579
-    ADD CONSTRAINT vacation_notification_pkey PRIMARY KEY (on_vacation, notified);
580
-
581
-
582
---
583
---
584
-
585
-ALTER TABLE ONLY vacation
586
-    ADD CONSTRAINT vacation_pkey PRIMARY KEY (email);
587
-
588
-
589
---
590
---
591
-
592
-CREATE INDEX alias_address_active ON alias USING btree (address, active);
593
-
594
-
595
---
596
---
597
-
598
-CREATE INDEX alias_domain_active ON alias_domain USING btree (alias_domain, active);
599
-
600
-
601
---
602
---
603
-
604
-CREATE INDEX alias_domain_idx ON alias USING btree (domain);
605
-
606
-
607
---
608
---
609
-
610
-CREATE INDEX domain_domain_active ON domain USING btree (domain, active);
611
-
612
-
613
---
614
---
615
-
616
-CREATE INDEX log_domain_timestamp_idx ON log USING btree (domain, "timestamp");
617
-
618
-
619
---
620
---
621
-
622
-CREATE INDEX mailbox_domain_idx ON mailbox USING btree (domain);
623
-
624
-
625
---
626
---
627
-
628
-CREATE INDEX mailbox_username_active ON mailbox USING btree (username, active);
629
-
630
-
631
---
632
---
633
-
634
-CREATE INDEX vacation_email_active ON vacation USING btree (email, active);
635
-
636
-
637
---
638
---
639
-
640
-CREATE TRIGGER mergequota BEFORE INSERT ON quota FOR EACH ROW EXECUTE PROCEDURE merge_quota();
641
-
642
-
643
---
644
---
645
-
646
-CREATE TRIGGER mergequota2 BEFORE INSERT ON quota2 FOR EACH ROW EXECUTE PROCEDURE merge_quota2();
647
-
648
-
649
---
650
---
651
-
652
-ALTER TABLE ONLY alias_domain
653
-    ADD CONSTRAINT alias_domain_alias_domain_fkey FOREIGN KEY (alias_domain) REFERENCES domain(domain) ON DELETE CASCADE;
654
-
655
-
656
---
657
---
658
-
659
-ALTER TABLE ONLY alias
660
-    ADD CONSTRAINT alias_domain_fkey FOREIGN KEY (domain) REFERENCES domain(domain);
661
-
662
-
663
---
664
---
665
-
666
-ALTER TABLE ONLY alias_domain
667
-    ADD CONSTRAINT alias_domain_target_domain_fkey FOREIGN KEY (target_domain) REFERENCES domain(domain) ON DELETE CASCADE;
668
-
669
-
670
---
671
---
672
-
673
-ALTER TABLE ONLY domain_admins
674
-    ADD CONSTRAINT domain_admins_domain_fkey FOREIGN KEY (domain) REFERENCES domain(domain);
675
-
676
-
677
---
678
---
679
-
680
-ALTER TABLE ONLY mailbox
681
-    ADD CONSTRAINT mailbox_domain_fkey1 FOREIGN KEY (domain) REFERENCES domain(domain);
682
-
683
-
684
---
685
---
686
-
687
-ALTER TABLE ONLY vacation
688
-    ADD CONSTRAINT vacation_domain_fkey1 FOREIGN KEY (domain) REFERENCES domain(domain);
689
-
690
-
691
---
692
---
693
-
694
-ALTER TABLE ONLY vacation_notification
695
-    ADD CONSTRAINT vacation_notification_on_vacation_fkey FOREIGN KEY (on_vacation) REFERENCES vacation(email) ON DELETE CASCADE;
696
-
697
---
698
---
699
-
700
-CREATE TABLE transport (
701
-    domain character varying(128) NOT NULL,
702
-    transport character varying(128) NOT NULL
703
-);
704
-
705
-
706
-ALTER TABLE transport OWNER TO postfixadmin;
707
-
708
---
709
---
710
-
711
-ALTER TABLE ONLY transport
712
-    ADD CONSTRAINT transport_pkey PRIMARY KEY (domain);
713
-
714
-
715
-
716
-
717
-
718
-
719
---
720
---
721
-
722
-CREATE TABLE recipient_bcc (
723
-    recipient character varying(128) NOT NULL,
724
-    bcc character varying(128) NOT NULL
725
-);
726
-
727
-
728
-ALTER TABLE recipient_bcc OWNER TO postfixadmin;
729
-
730
---
731
---
732
-
733
-ALTER TABLE ONLY recipient_bcc
734
-    ADD CONSTRAINT recipient_bcc_pkey PRIMARY KEY (recipient);

+ 650
- 0
postgresql/docker-entrypoint-initdb.d/10_init.sql ファイルの表示

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

+ 34
- 0
postgresql/docker-entrypoint-initdb.d/20_customs.sql ファイルの表示

@@ -0,0 +1,34 @@
1
+--
2
+-- Name: recipient_bcc; Type: TABLE; Schema: public; Owner: -
3
+--
4
+
5
+CREATE TABLE public.recipient_bcc (
6
+    recipient character varying(128) NOT NULL,
7
+    bcc character varying(128) NOT NULL
8
+);
9
+
10
+--
11
+-- Name: transport; Type: TABLE; Schema: public; Owner: postfixadmin; Tablespace:
12
+--
13
+
14
+CREATE TABLE public.transport (
15
+    domain character varying(128) NOT NULL,
16
+    transport character varying(128) NOT NULL
17
+);
18
+
19
+--
20
+-- Name: recipient_bcc recipient_bcc_pkey; Type: CONSTRAINT; Schema: public; Owner: -
21
+--
22
+
23
+ALTER TABLE ONLY public.recipient_bcc
24
+    ADD CONSTRAINT recipient_bcc_pkey PRIMARY KEY (recipient);
25
+
26
+--
27
+-- Name: transport_pkey; Type: CONSTRAINT; Schema: public; Owner: postfixadmin; Tablespace:
28
+--
29
+
30
+ALTER TABLE ONLY public.transport
31
+    ADD CONSTRAINT transport_pkey PRIMARY KEY (domain);
32
+
33
+
34
+ALTER TABLE public.alias ADD COLUMN is_regexp boolean DEFAULT false NOT NULL;

+ 143
- 0
postgresql/docker-entrypoint-initdb.d/30_data.sql ファイルの表示

@@ -0,0 +1,143 @@
1
+--
2
+-- PostgreSQL database dump
3
+--
4
+
5
+-- Dumped from database version 11.2 (Debian 11.2-1.pgdg90+1)
6
+-- Dumped by pg_dump version 11.2 (Debian 11.2-1.pgdg90+1)
7
+
8
+SET statement_timeout = 0;
9
+SET lock_timeout = 0;
10
+SET idle_in_transaction_session_timeout = 0;
11
+SET client_encoding = 'UTF8';
12
+SET standard_conforming_strings = on;
13
+SELECT pg_catalog.set_config('search_path', '', false);
14
+SET check_function_bodies = false;
15
+SET client_min_messages = warning;
16
+SET row_security = off;
17
+
18
+--
19
+-- Data for Name: admin; Type: TABLE DATA; Schema: public; Owner: -
20
+--
21
+
22
+INSERT INTO public.admin VALUES ('root@example.com', '$1$5f27bb4a$ex2LmG38/9eBS118CRnYX0', '2019-03-23 12:53:08.031365+00', '2019-03-23 12:53:08.031365+00', true, true, '', '', '', '2019-03-23 12:53:07+00');
23
+
24
+
25
+--
26
+-- Data for Name: domain; Type: TABLE DATA; Schema: public; Owner: -
27
+--
28
+
29
+INSERT INTO public.domain VALUES ('ALL', '', 0, 0, 0, 0, '', false, '2019-03-23 12:53:07.568065+00', '2019-03-23 12:53:07.568065+00', true);
30
+INSERT INTO public.domain VALUES ('example.com', '', 0, 0, 0, 0, 'virtual', false, '2019-03-23 12:54:01.535706+00', '2019-03-23 12:54:01.535706+00', true);
31
+
32
+
33
+--
34
+-- Data for Name: alias; Type: TABLE DATA; Schema: public; Owner: -
35
+--
36
+
37
+INSERT INTO public.alias VALUES ('root@example.com', 'root@example.com', 'example.com', '2019-03-23 12:54:21.407232+00', '2019-03-23 12:54:21.407232+00', true, false);
38
+INSERT INTO public.alias VALUES ('abuse@example.com', 'root@example.com', 'example.com', '2019-03-23 12:54:01.5375+00', '2019-03-23 12:54:33.237608+00', true, false);
39
+INSERT INTO public.alias VALUES ('hostmaster@example.com', 'root@example.com', 'example.com', '2019-03-23 12:54:01.539417+00', '2019-03-23 12:54:40.230445+00', true, false);
40
+INSERT INTO public.alias VALUES ('postmaster@example.com', 'root@example.com', 'example.com', '2019-03-23 12:54:01.541357+00', '2019-03-23 12:54:43.793966+00', true, false);
41
+INSERT INTO public.alias VALUES ('webmaster@example.com', 'root@example.com', 'example.com', '2019-03-23 12:54:01.543084+00', '2019-03-23 12:54:46.853014+00', true, false);
42
+INSERT INTO public.alias VALUES ('auth.mta@example.com', 'auth.mta@example.com', 'example.com', '2019-03-23 12:55:37.492584+00', '2019-03-23 12:55:37.492584+00', true, false);
43
+
44
+
45
+--
46
+-- Data for Name: alias_domain; Type: TABLE DATA; Schema: public; Owner: -
47
+--
48
+
49
+
50
+
51
+--
52
+-- Data for Name: config; Type: TABLE DATA; Schema: public; Owner: -
53
+--
54
+
55
+INSERT INTO public.config VALUES (1, 'version', '1841');
56
+
57
+
58
+--
59
+-- Data for Name: domain_admins; Type: TABLE DATA; Schema: public; Owner: -
60
+--
61
+
62
+INSERT INTO public.domain_admins VALUES ('root@example.com', 'ALL', '2019-03-23 12:53:08.035414+00', true);
63
+
64
+
65
+--
66
+-- Data for Name: fetchmail; Type: TABLE DATA; Schema: public; Owner: -
67
+--
68
+
69
+
70
+
71
+--
72
+-- Data for Name: log; Type: TABLE DATA; Schema: public; Owner: -
73
+--
74
+
75
+INSERT INTO public.log VALUES ('2019-03-23 12:53:08.037294+00', 'SETUP.PHP (172.27.0.1)', '', 'create_admin', 'root@example.com', 1);
76
+INSERT INTO public.log VALUES ('2019-03-23 12:54:01.544884+00', 'root@example.com (172.27.0.1)', 'example.com', 'create_domain', 'example.com', 2);
77
+INSERT INTO public.log VALUES ('2019-03-23 12:54:21.409148+00', 'root@example.com (172.27.0.1)', 'example.com', 'create_alias', 'root@example.com', 3);
78
+INSERT INTO public.log VALUES ('2019-03-23 12:54:21.413803+00', 'root@example.com (172.27.0.1)', 'example.com', 'create_mailbox', 'root@example.com', 4);
79
+INSERT INTO public.log VALUES ('2019-03-23 12:54:33.241774+00', 'root@example.com (172.27.0.1)', 'example.com', 'edit_alias', 'abuse@example.com', 5);
80
+INSERT INTO public.log VALUES ('2019-03-23 12:54:40.236087+00', 'root@example.com (172.27.0.1)', 'example.com', 'edit_alias', 'hostmaster@example.com', 6);
81
+INSERT INTO public.log VALUES ('2019-03-23 12:54:43.797741+00', 'root@example.com (172.27.0.1)', 'example.com', 'edit_alias', 'postmaster@example.com', 7);
82
+INSERT INTO public.log VALUES ('2019-03-23 12:54:46.856653+00', 'root@example.com (172.27.0.1)', 'example.com', 'edit_alias', 'webmaster@example.com', 8);
83
+INSERT INTO public.log VALUES ('2019-03-23 12:55:37.494506+00', 'root@example.com (172.27.0.1)', 'example.com', 'create_alias', 'auth.mta@example.com', 9);
84
+INSERT INTO public.log VALUES ('2019-03-23 12:55:37.499055+00', 'root@example.com (172.27.0.1)', 'example.com', 'create_mailbox', 'auth.mta@example.com', 10);
85
+
86
+
87
+--
88
+-- Data for Name: mailbox; Type: TABLE DATA; Schema: public; Owner: -
89
+--
90
+
91
+INSERT INTO public.mailbox VALUES ('root@example.com', '$1$89e3923e$jvlRF5Fk8z.O9wFDqFRAN0', 'Root', 'example.com/root/', 0, '2019-03-23 12:54:21.411801+00', '2019-03-23 12:54:21.411801+00', true, 'example.com', 'root', '', '', '', '2019-03-23 12:54:21+00');
92
+INSERT INTO public.mailbox VALUES ('auth.mta@example.com', '$1$da9d780c$yhEfPiIR6JHgh0KqZ/9QR0', 'auth.mta', 'example.com/auth.mta/', 0, '2019-03-23 12:55:37.497114+00', '2019-03-23 12:55:37.497114+00', true, 'example.com', 'auth.mta', '', '', '', '2019-03-23 12:55:37+00');
93
+
94
+
95
+--
96
+-- Data for Name: quota; Type: TABLE DATA; Schema: public; Owner: -
97
+--
98
+
99
+
100
+
101
+--
102
+-- Data for Name: quota2; Type: TABLE DATA; Schema: public; Owner: -
103
+--
104
+
105
+
106
+
107
+--
108
+-- Data for Name: vacation; Type: TABLE DATA; Schema: public; Owner: -
109
+--
110
+
111
+
112
+
113
+--
114
+-- Data for Name: vacation_notification; Type: TABLE DATA; Schema: public; Owner: -
115
+--
116
+
117
+
118
+
119
+--
120
+-- Name: config_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
121
+--
122
+
123
+SELECT pg_catalog.setval('public.config_id_seq', 33, true);
124
+
125
+
126
+--
127
+-- Name: fetchmail_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
128
+--
129
+
130
+SELECT pg_catalog.setval('public.fetchmail_id_seq', 33, true);
131
+
132
+
133
+--
134
+-- Name: log_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
135
+--
136
+
137
+SELECT pg_catalog.setval('public.log_id_seq', 10, true);
138
+
139
+
140
+--
141
+-- PostgreSQL database dump complete
142
+--
143
+

読み込み中…
キャンセル
保存