-
Notifications
You must be signed in to change notification settings - Fork 2
/
fido.sql
1088 lines (715 loc) · 24.8 KB
/
fido.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
--
-- Name: fido; Type: DATABASE; Schema: -; Owner: fido
--
CREATE DATABASE fido WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'ru_RU.UTF-8' LC_CTYPE = 'ru_RU.UTF-8';
ALTER DATABASE fido OWNER TO fido;
\connect fido
SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
SET search_path = public, pg_catalog;
--
-- Name: n_5(); Type: FUNCTION; Schema: public; Owner: postgres
--
CREATE FUNCTION n_5() RETURNS integer
LANGUAGE sql IMMUTABLE STRICT
AS $$
SELECT 5;
$$;
ALTER FUNCTION public.n_5() OWNER TO postgres;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: addresses; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE addresses (
id bigint NOT NULL,
domain integer,
text character varying,
owner character varying,
"group" bigint,
last bigint
);
ALTER TABLE public.addresses OWNER TO postgres;
--
-- Name: COLUMN addresses.last; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN addresses.last IS 'Last message sent to this address.
Introduced to improve export times.';
--
-- Name: addresses_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE addresses_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.addresses_id_seq OWNER TO postgres;
--
-- Name: addresses_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE addresses_id_seq OWNED BY addresses.id;
--
-- Name: deletedvitalsubscriptionwatermarks; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE deletedvitalsubscriptionwatermarks (
id bigint NOT NULL,
target bigint,
message bigint
);
ALTER TABLE public.deletedvitalsubscriptionwatermarks OWNER TO postgres;
--
-- Name: deletedvitalsubscriptionwatermarks_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE deletedvitalsubscriptionwatermarks_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.deletedvitalsubscriptionwatermarks_id_seq OWNER TO postgres;
--
-- Name: deletedvitalsubscriptionwatermarks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE deletedvitalsubscriptionwatermarks_id_seq OWNED BY deletedvitalsubscriptionwatermarks.id;
--
-- Name: domains; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE domains (
id integer NOT NULL,
name character varying NOT NULL,
verifysubscriptions boolean
);
ALTER TABLE public.domains OWNER TO postgres;
--
-- Name: domains_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE domains_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.domains_id_seq OWNER TO postgres;
--
-- Name: domains_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE domains_id_seq OWNED BY domains.id;
--
-- Name: files; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE files (
id bigint NOT NULL,
length bigint,
crc32 character(8),
sha256 character(64),
firstseenas character varying
);
ALTER TABLE public.files OWNER TO postgres;
--
-- Name: files_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE files_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.files_id_seq OWNER TO postgres;
--
-- Name: files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE files_id_seq OWNED BY files.id;
--
-- Name: lastsent; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE lastsent (
id bigint NOT NULL,
subscriber bigint,
domain bigint,
lastsent bigint
);
ALTER TABLE public.lastsent OWNER TO postgres;
--
-- Name: lastsent_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE lastsent_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.lastsent_id_seq OWNER TO postgres;
--
-- Name: lastsent_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE lastsent_id_seq OWNED BY lastsent.id;
--
-- Name: links; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE links (
id bigint NOT NULL,
address bigint,
authentication xml,
connection xml,
pktn bigint DEFAULT 0 NOT NULL,
bundlen bigint DEFAULT 0 NOT NULL,
ticn bigint DEFAULT 0 NOT NULL,
pktformat character varying DEFAULT 'pkt2'::character varying,
bundle character varying DEFAULT 'zip'::character varying
);
ALTER TABLE public.links OWNER TO postgres;
--
-- Name: links_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE links_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.links_id_seq OWNER TO postgres;
--
-- Name: links_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE links_id_seq OWNED BY links.id;
--
-- Name: links_simple; Type: VIEW; Schema: public; Owner: postgres
--
CREATE VIEW links_simple AS
SELECT l.domain AS link_domain, l.text AS link_address, links.authentication, links.connection FROM links, addresses l WHERE (l.id = links.address);
ALTER TABLE public.links_simple OWNER TO postgres;
--
-- Name: listings; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE listings (
id bigint NOT NULL,
address bigint,
list bigint
);
ALTER TABLE public.listings OWNER TO postgres;
--
-- Name: listings_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE listings_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.listings_id_seq OWNER TO postgres;
--
-- Name: listings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE listings_id_seq OWNED BY listings.id;
--
-- Name: lists; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE lists (
id bigint NOT NULL,
name character varying
);
ALTER TABLE public.lists OWNER TO postgres;
--
-- Name: lists_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE lists_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.lists_id_seq OWNER TO postgres;
--
-- Name: lists_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE lists_id_seq OWNED BY lists.id;
--
-- Name: messages; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE messages (
id bigint NOT NULL,
source bigint,
destination bigint,
header xml,
body text,
processed integer DEFAULT 0 NOT NULL,
msgid character varying NOT NULL,
receivedfrom bigint,
origcharset character varying,
receivedtimestamp timestamp with time zone
);
ALTER TABLE public.messages OWNER TO postgres;
--
-- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE messages_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.messages_id_seq OWNER TO postgres;
--
-- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE messages_id_seq OWNED BY messages.id;
--
-- Name: messages_simple; Type: VIEW; Schema: public; Owner: postgres
--
CREATE VIEW messages_simple AS
SELECT f.domain AS from_domain, f.text AS from_address, t.domain AS to_domain, t.text AS to_address, m.header, m.body, m.processed, m.msgid, m.receivedfrom FROM messages m, addresses f, addresses t WHERE ((t.id = m.destination) AND (f.id = m.source)) ORDER BY m.id;
ALTER TABLE public.messages_simple OWNER TO postgres;
--
-- Name: msgid_seq; Type: SEQUENCE; Schema: public; Owner: fido
--
CREATE SEQUENCE msgid_seq
START WITH 1330764251
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.msgid_seq OWNER TO fido;
--
-- Name: process_status; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE process_status (
id integer NOT NULL,
name character varying
);
ALTER TABLE public.process_status OWNER TO postgres;
--
-- Name: process_status_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE process_status_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.process_status_id_seq OWNER TO postgres;
--
-- Name: process_status_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE process_status_id_seq OWNED BY process_status.id;
--
-- Name: receivedfiles; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE receivedfiles (
id bigint NOT NULL,
"from" bigint,
file bigint,
name character varying,
"time" timestamp with time zone
);
ALTER TABLE public.receivedfiles OWNER TO postgres;
--
-- Name: receivedfiles_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE receivedfiles_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.receivedfiles_id_seq OWNER TO postgres;
--
-- Name: receivedfiles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE receivedfiles_id_seq OWNED BY receivedfiles.id;
--
-- Name: subscriptions; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE subscriptions (
id bigint NOT NULL,
vital boolean,
target bigint,
subscriber bigint,
lastsent bigint DEFAULT (-1) NOT NULL,
commuter integer
);
ALTER TABLE public.subscriptions OWNER TO postgres;
--
-- Name: COLUMN subscriptions.vital; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN subscriptions.vital IS 'tossing message without vital subscription (uplink for echo, nexthop for netmail) must fail ';
--
-- Name: subscriptions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE subscriptions_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.subscriptions_id_seq OWNER TO postgres;
--
-- Name: subscriptions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE subscriptions_id_seq OWNED BY subscriptions.id;
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY addresses ALTER COLUMN id SET DEFAULT nextval('addresses_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY deletedvitalsubscriptionwatermarks ALTER COLUMN id SET DEFAULT nextval('deletedvitalsubscriptionwatermarks_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY domains ALTER COLUMN id SET DEFAULT nextval('domains_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY files ALTER COLUMN id SET DEFAULT nextval('files_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY lastsent ALTER COLUMN id SET DEFAULT nextval('lastsent_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY links ALTER COLUMN id SET DEFAULT nextval('links_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY listings ALTER COLUMN id SET DEFAULT nextval('listings_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY lists ALTER COLUMN id SET DEFAULT nextval('lists_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY messages ALTER COLUMN id SET DEFAULT nextval('messages_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY process_status ALTER COLUMN id SET DEFAULT nextval('process_status_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY receivedfiles ALTER COLUMN id SET DEFAULT nextval('receivedfiles_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY subscriptions ALTER COLUMN id SET DEFAULT nextval('subscriptions_id_seq'::regclass);
--
-- Name: addresses_domain_text_key; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY addresses
ADD CONSTRAINT addresses_domain_text_key UNIQUE (domain, text);
--
-- Name: addresses_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY addresses
ADD CONSTRAINT addresses_pkey PRIMARY KEY (id);
--
-- Name: deletedvitalsubscriptionwatermarks_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY deletedvitalsubscriptionwatermarks
ADD CONSTRAINT deletedvitalsubscriptionwatermarks_pkey PRIMARY KEY (id);
--
-- Name: deletedvitalsubscriptionwatermarks_target_key; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY deletedvitalsubscriptionwatermarks
ADD CONSTRAINT deletedvitalsubscriptionwatermarks_target_key UNIQUE (target);
--
-- Name: domains_name_key; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY domains
ADD CONSTRAINT domains_name_key UNIQUE (name);
--
-- Name: domains_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY domains
ADD CONSTRAINT domains_pkey PRIMARY KEY (id);
--
-- Name: files_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY files
ADD CONSTRAINT files_pkey PRIMARY KEY (id);
--
-- Name: lastsent_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY lastsent
ADD CONSTRAINT lastsent_pkey PRIMARY KEY (id);
--
-- Name: links_address_key; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY links
ADD CONSTRAINT links_address_key UNIQUE (address);
--
-- Name: links_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY links
ADD CONSTRAINT links_pkey PRIMARY KEY (id);
--
-- Name: listings_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY listings
ADD CONSTRAINT listings_pkey PRIMARY KEY (id);
--
-- Name: lists_name_key; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY lists
ADD CONSTRAINT lists_name_key UNIQUE (name);
--
-- Name: lists_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY lists
ADD CONSTRAINT lists_pkey PRIMARY KEY (id);
--
-- Name: messages_msgid_key; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY messages
ADD CONSTRAINT messages_msgid_key UNIQUE (msgid);
--
-- Name: messages_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY messages
ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
--
-- Name: process_status_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY process_status
ADD CONSTRAINT process_status_pkey PRIMARY KEY (id);
--
-- Name: receivedfiles_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY receivedfiles
ADD CONSTRAINT receivedfiles_pkey PRIMARY KEY (id);
--
-- Name: subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY subscriptions
ADD CONSTRAINT subscriptions_pkey PRIMARY KEY (id);
--
-- Name: subscriptions_target_subscriber_key; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--
ALTER TABLE ONLY subscriptions
ADD CONSTRAINT subscriptions_target_subscriber_key UNIQUE (target, subscriber);
--
-- Name: addresses_group_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE INDEX addresses_group_idx ON addresses USING btree ("group");
--
-- Name: messages_destination_id_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE INDEX messages_destination_id_idx ON messages USING btree (destination, id DESC);
--
-- Name: messages_destination_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE INDEX messages_destination_idx ON messages USING btree (destination);
--
-- Name: messages_destination_processed_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE INDEX messages_destination_processed_idx ON messages USING btree (destination, processed);
--
-- Name: subscriptions_subscriber_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
--
CREATE INDEX subscriptions_subscriber_idx ON subscriptions USING btree (subscriber);
--
-- Name: addresses_domain_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY addresses
ADD CONSTRAINT addresses_domain_fkey FOREIGN KEY (domain) REFERENCES domains(id);
--
-- Name: addresses_group_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY addresses
ADD CONSTRAINT addresses_group_fkey FOREIGN KEY ("group") REFERENCES addresses(id);
--
-- Name: deletedvitalsubscriptionwatermarks_message_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY deletedvitalsubscriptionwatermarks
ADD CONSTRAINT deletedvitalsubscriptionwatermarks_message_fkey FOREIGN KEY (message) REFERENCES messages(id);
--
-- Name: deletedvitalsubscriptionwatermarks_target_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY deletedvitalsubscriptionwatermarks
ADD CONSTRAINT deletedvitalsubscriptionwatermarks_target_fkey FOREIGN KEY (target) REFERENCES addresses(id);
--
-- Name: lastsent_domain_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY lastsent
ADD CONSTRAINT lastsent_domain_fkey FOREIGN KEY (domain) REFERENCES domains(id);
--
-- Name: lastsent_lastsent_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY lastsent
ADD CONSTRAINT lastsent_lastsent_fkey FOREIGN KEY (lastsent) REFERENCES messages(id);
--
-- Name: lastsent_subscriber_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY lastsent
ADD CONSTRAINT lastsent_subscriber_fkey FOREIGN KEY (subscriber) REFERENCES addresses(id);
--
-- Name: links_address_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY links
ADD CONSTRAINT links_address_fkey FOREIGN KEY (address) REFERENCES addresses(id);
--
-- Name: listings_address_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY listings
ADD CONSTRAINT listings_address_fkey FOREIGN KEY (address) REFERENCES addresses(id);
--
-- Name: listings_list_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY listings
ADD CONSTRAINT listings_list_fkey FOREIGN KEY (list) REFERENCES lists(id);
--
-- Name: messages_destination_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY messages
ADD CONSTRAINT messages_destination_fkey FOREIGN KEY (destination) REFERENCES addresses(id);
--
-- Name: messages_processed_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY messages
ADD CONSTRAINT messages_processed_fkey FOREIGN KEY (processed) REFERENCES process_status(id);
--
-- Name: messages_receivedfrom_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY messages
ADD CONSTRAINT messages_receivedfrom_fkey FOREIGN KEY (receivedfrom) REFERENCES addresses(id);
--
-- Name: messages_source_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY messages
ADD CONSTRAINT messages_source_fkey FOREIGN KEY (source) REFERENCES addresses(id);
--
-- Name: receivedfiles_file_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY receivedfiles
ADD CONSTRAINT receivedfiles_file_fkey FOREIGN KEY (file) REFERENCES files(id);
--
-- Name: receivedfiles_from_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY receivedfiles
ADD CONSTRAINT receivedfiles_from_fkey FOREIGN KEY ("from") REFERENCES addresses(id);
--
-- Name: subscriptions_subscriber_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY subscriptions
ADD CONSTRAINT subscriptions_subscriber_fkey FOREIGN KEY (subscriber) REFERENCES addresses(id);
--
-- Name: subscriptions_target_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY subscriptions
ADD CONSTRAINT subscriptions_target_fkey FOREIGN KEY (target) REFERENCES addresses(id);
--
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--
REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;
--
-- Name: addresses; Type: ACL; Schema: public; Owner: postgres
--
REVOKE ALL ON TABLE addresses FROM PUBLIC;
REVOKE ALL ON TABLE addresses FROM postgres;
GRANT ALL ON TABLE addresses TO postgres;
GRANT SELECT,INSERT,UPDATE ON TABLE addresses TO fido;
--
-- Name: addresses_id_seq; Type: ACL; Schema: public; Owner: postgres
--
REVOKE ALL ON SEQUENCE addresses_id_seq FROM PUBLIC;
REVOKE ALL ON SEQUENCE addresses_id_seq FROM postgres;
GRANT ALL ON SEQUENCE addresses_id_seq TO postgres;
GRANT UPDATE ON SEQUENCE addresses_id_seq TO fido;
--
-- Name: deletedvitalsubscriptionwatermarks; Type: ACL; Schema: public; Owner: postgres
--
REVOKE ALL ON TABLE deletedvitalsubscriptionwatermarks FROM PUBLIC;
REVOKE ALL ON TABLE deletedvitalsubscriptionwatermarks FROM postgres;
GRANT ALL ON TABLE deletedvitalsubscriptionwatermarks TO postgres;
GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE deletedvitalsubscriptionwatermarks TO fido;
--
-- Name: deletedvitalsubscriptionwatermarks_id_seq; Type: ACL; Schema: public; Owner: postgres
--
REVOKE ALL ON SEQUENCE deletedvitalsubscriptionwatermarks_id_seq FROM PUBLIC;
REVOKE ALL ON SEQUENCE deletedvitalsubscriptionwatermarks_id_seq FROM postgres;