-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathdatabase_postgresql.sql
More file actions
2449 lines (1533 loc) · 69.8 KB
/
Copy pathdatabase_postgresql.sql
File metadata and controls
2449 lines (1533 loc) · 69.8 KB
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
--
\restrict ssCmos48SGsyaYIe5i0ycRliyJ4n2RhibGrk0Oda8Qc1O5MxvVOrv55s9lcCzm3
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
--
-- Name: address_address_type_enum; Type: TYPE; Schema: public; Owner: postgres
--
CREATE TYPE public.address_address_type_enum AS ENUM (
'physical',
'postal',
'virtual'
);
ALTER TYPE public.address_address_type_enum OWNER TO postgres;
--
-- Name: location_location_type_enum; Type: TYPE; Schema: public; Owner: postgres
--
CREATE TYPE public.location_location_type_enum AS ENUM (
'physical',
'postal',
'virtual'
);
ALTER TYPE public.location_location_type_enum OWNER TO postgres;
--
-- Name: schedule_freq_enum; Type: TYPE; Schema: public; Owner: postgres
--
CREATE TYPE public.schedule_freq_enum AS ENUM (
'WEEKLY',
'MONTHLY'
);
ALTER TYPE public.schedule_freq_enum OWNER TO postgres;
--
-- Name: schedule_wkst_enum; Type: TYPE; Schema: public; Owner: postgres
--
CREATE TYPE public.schedule_wkst_enum AS ENUM (
'MO',
'TU',
'WE',
'TH',
'FR',
'SA',
'SU'
);
ALTER TYPE public.schedule_wkst_enum OWNER TO postgres;
--
-- Name: service_status_enum; Type: TYPE; Schema: public; Owner: postgres
--
CREATE TYPE public.service_status_enum AS ENUM (
'active',
'inactive',
'defunct',
'temporarily closed'
);
ALTER TYPE public.service_status_enum OWNER TO postgres;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: accessibility; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.accessibility (
id character varying(250) NOT NULL,
location_id character varying(250),
description text,
details text,
url text
);
ALTER TABLE public.accessibility OWNER TO postgres;
--
-- Name: COLUMN accessibility.id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.accessibility.id IS 'The identifier for this accessibility information. Each entry must have a unique identifier.';
--
-- Name: COLUMN accessibility.location_id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.accessibility.location_id IS 'The identifier for the location of the accessibility provision.';
--
-- Name: COLUMN accessibility.description; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.accessibility.description IS 'A free text description of the assistance or infrastructure that facilitates access to clients with disabilities.';
--
-- Name: COLUMN accessibility.details; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.accessibility.details IS 'Any further details relating to the relevant accessibility arrangements at this location.';
--
-- Name: COLUMN accessibility.url; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.accessibility.url IS 'The URL of a page giving more information about the accessibility of the location.';
--
-- Name: address; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.address (
id character varying(250) NOT NULL,
location_id character varying(250),
attention text,
address_1 text NOT NULL,
address_2 text,
city text NOT NULL,
region text,
state_province text NOT NULL,
postal_code text NOT NULL,
country text NOT NULL,
address_type public.address_address_type_enum NOT NULL
);
ALTER TABLE public.address OWNER TO postgres;
--
-- Name: COLUMN address.id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.address.id IS 'The identifier of the postal address. Each postal address must have a unique identifier.';
--
-- Name: COLUMN address.location_id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.address.location_id IS 'The identifier of the location for this postal address.';
--
-- Name: COLUMN address.attention; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.address.attention IS 'The name of the person or entity whose attention should be sought at the location. These are often included as a "care of" component of an address.';
--
-- Name: COLUMN address.address_1; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.address.address_1 IS 'The first line(s) of the address, including office, building number and street.';
--
-- Name: COLUMN address.address_2; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.address.address_2 IS 'A second (additional) line of address information.';
--
-- Name: COLUMN address.city; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.address.city IS 'The city in which the address is located.';
--
-- Name: COLUMN address.region; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.address.region IS 'The region in which the address is located (optional).';
--
-- Name: COLUMN address.state_province; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.address.state_province IS 'The state or province in which the address is located.';
--
-- Name: COLUMN address.postal_code; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.address.postal_code IS 'The postal code for the address.';
--
-- Name: COLUMN address.country; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.address.country IS 'The country in which the address is located. This should be given as an ISO 3361-1 country code (two letter abbreviation).';
--
-- Name: COLUMN address.address_type; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.address.address_type IS 'The type of address which may be `physical`, `postal`, or `virtual`.';
--
-- Name: attribute; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.attribute (
id character varying(250) NOT NULL,
link_id text NOT NULL,
taxonomy_term_id character varying(250) NOT NULL,
link_type text,
link_entity text NOT NULL,
value text,
label text
);
ALTER TABLE public.attribute OWNER TO postgres;
--
-- Name: COLUMN attribute.id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.attribute.id IS 'The identifier of the attribute entry. Each attribute entry should have a unique identifier.';
--
-- Name: COLUMN attribute.link_id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.attribute.link_id IS 'The identifier of the entity to which this taxonomy term applies.';
--
-- Name: COLUMN attribute.taxonomy_term_id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.attribute.taxonomy_term_id IS 'The identifier of this taxonomy term from the taxonomy table.';
--
-- Name: COLUMN attribute.link_type; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.attribute.link_type IS 'A code taken from an enumerated open codelist to indicate what the taxonomy term describes, e.g. the service eligibility or intended audience.';
--
-- Name: COLUMN attribute.link_entity; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.attribute.link_entity IS 'The table of the Link Identifier.';
--
-- Name: COLUMN attribute.value; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.attribute.value IS 'The value (if any) of an attribute.';
--
-- Name: COLUMN attribute.label; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.attribute.label IS 'A free text label of the attribute.';
--
-- Name: contact; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.contact (
id character varying(250) NOT NULL,
organization_id character varying(250),
service_id character varying(250),
service_at_location_id character varying(250),
location_id character varying(250),
name text,
title text,
department text,
email text
);
ALTER TABLE public.contact OWNER TO postgres;
--
-- Name: COLUMN contact.id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.contact.id IS 'The identifier for the contact. Each contact must have a unique identifier.';
--
-- Name: COLUMN contact.organization_id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.contact.organization_id IS 'The identifier of the organization for which this is a contact.';
--
-- Name: COLUMN contact.service_id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.contact.service_id IS 'The identifier of the service for which this is a contact.';
--
-- Name: COLUMN contact.service_at_location_id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.contact.service_at_location_id IS 'The identifier of the ‘service at location’ entry, when this contact is specific to a service in a particular location.';
--
-- Name: COLUMN contact.location_id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.contact.location_id IS 'The identifier for the location of the contact.';
--
-- Name: COLUMN contact.name; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.contact.name IS 'The name of the contact.';
--
-- Name: COLUMN contact.title; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.contact.title IS 'The job title of the contact.';
--
-- Name: COLUMN contact.department; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.contact.department IS 'The department that the contact is a part of.';
--
-- Name: COLUMN contact.email; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.contact.email IS 'The email address of the contact.';
--
-- Name: cost_option; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.cost_option (
id character varying(250) NOT NULL,
service_id character varying(250) NOT NULL,
valid_from date,
valid_to date,
option text,
currency text,
amount numeric,
amount_description text
);
ALTER TABLE public.cost_option OWNER TO postgres;
--
-- Name: COLUMN cost_option.id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.cost_option.id IS 'The identifier for the cost option. Each entry must have a unique identifier';
--
-- Name: COLUMN cost_option.service_id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.cost_option.service_id IS 'The identifier of the services for which the entry describes the cost.';
--
-- Name: COLUMN cost_option.valid_from; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.cost_option.valid_from IS 'The date when this price is valid from.';
--
-- Name: COLUMN cost_option.valid_to; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.cost_option.valid_to IS 'The date when this price is valid to.';
--
-- Name: COLUMN cost_option.option; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.cost_option.option IS 'Conditions associated with the cost option.';
--
-- Name: COLUMN cost_option.currency; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.cost_option.currency IS 'The 3 letter currency code of this cost option (expected to be gbp by Open Referral UK).';
--
-- Name: COLUMN cost_option.amount; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.cost_option.amount IS 'The cost of the option, expressed as an amount.';
--
-- Name: COLUMN cost_option.amount_description; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.cost_option.amount_description IS 'Specific details qualifying the cost amount.';
--
-- Name: funding; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.funding (
id character varying(250) NOT NULL,
organization_id character varying(250),
service_id character varying(250),
source text
);
ALTER TABLE public.funding OWNER TO postgres;
--
-- Name: COLUMN funding.id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.funding.id IS 'The identifier for the funding. Each entry must have a unique identifier.';
--
-- Name: COLUMN funding.organization_id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.funding.organization_id IS 'The identifier of the organization in receipt of this funding.';
--
-- Name: COLUMN funding.service_id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.funding.service_id IS 'The identifier of the service in receipt of this funding.';
--
-- Name: COLUMN funding.source; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.funding.source IS 'A free text description of the source of funds for this organization or service.';
--
-- Name: language; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.language (
id character varying(250) NOT NULL,
service_id character varying(250),
location_id character varying(250),
phone_id character varying(250),
name text,
code text,
note text
);
ALTER TABLE public.language OWNER TO postgres;
--
-- Name: COLUMN language.id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.language.id IS 'The identifier for the language. Each entry must have a unique identifier.';
--
-- Name: COLUMN language.service_id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.language.service_id IS 'The identifier of the service for which the entry describes the languages in which services are delivered.';
--
-- Name: COLUMN language.location_id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.language.location_id IS 'The identifier of the location for which the entry describes the languages in which services are delivered.';
--
-- Name: COLUMN language.phone_id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.language.phone_id IS 'The identifier of the phone for which the entry describes the languages in which services delivered.';
--
-- Name: COLUMN language.name; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.language.name IS 'The name of the language in which the service is delivered.';
--
-- Name: COLUMN language.code; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.language.code IS 'The ISO 639-1 or ISO 639-3 code for the language.';
--
-- Name: COLUMN language.note; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.language.note IS 'A free text description of any additional context or services provided for this language.';
--
-- Name: location; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.location (
id character varying(250) NOT NULL,
location_type public.location_location_type_enum NOT NULL,
url text,
organization_id character varying(250),
name text,
alternate_name text,
description text,
transportation text,
latitude numeric,
longitude numeric,
external_identifier text,
external_identifier_type text
);
ALTER TABLE public.location OWNER TO postgres;
--
-- Name: COLUMN location.id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.location.id IS 'The identifier of the location. Each location must have a unique identifier.';
--
-- Name: COLUMN location.location_type; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.location.location_type IS 'The type of location, which may be either `physical`, `postal`, or `virtual`.';
--
-- Name: COLUMN location.url; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.location.url IS 'If location_type is virtual, then this field represents the URL of a virtual location.';
--
-- Name: COLUMN location.organization_id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.location.organization_id IS 'The organization identifier for a location. This is the organization that is responsible for maintaining information about this location. The identifier of the organization should be given here. Details of the services the organization delivers at this location should be provided in the services_at_location table.';
--
-- Name: COLUMN location.name; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.location.name IS 'The name of the location.';
--
-- Name: COLUMN location.alternate_name; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.location.alternate_name IS 'An (optional) alternative name of the location.';
--
-- Name: COLUMN location.description; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.location.description IS 'A free text description of the location.';
--
-- Name: COLUMN location.transportation; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.location.transportation IS 'A free text description of the access to public or private transportation to and from the location.';
--
-- Name: COLUMN location.latitude; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.location.latitude IS 'The latitude of the location expressed in decimal degrees in WGS84 datum.';
--
-- Name: COLUMN location.longitude; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.location.longitude IS 'The longitude of the location expressed in decimal degrees in WGS84 datum.';
--
-- Name: COLUMN location.external_identifier; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.location.external_identifier IS 'A third party identifier for the location, which can be drawn from other services e.g. UK UPRN.';
--
-- Name: COLUMN location.external_identifier_type; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.location.external_identifier_type IS 'The scheme used for the location''s external_identifier e.g. UK UPRN.';
--
-- Name: meta_table_description; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.meta_table_description (
id character varying(250) NOT NULL,
name text,
language text,
character_set text
);
ALTER TABLE public.meta_table_description OWNER TO postgres;
--
-- Name: COLUMN meta_table_description.id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.meta_table_description.id IS 'The identifier for the metadata description. Each entry must have a unique identifier.';
--
-- Name: COLUMN meta_table_description.name; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.meta_table_description.name IS 'The name for the metadata description.';
--
-- Name: COLUMN meta_table_description.language; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.meta_table_description.language IS 'The ISO 639-1 or ISO 639-3 code for the language of the metadata description.';
--
-- Name: COLUMN meta_table_description.character_set; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.meta_table_description.character_set IS 'The character set of the metadata description.';
--
-- Name: metadata; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.metadata (
id character varying(250) NOT NULL,
resource_id text NOT NULL,
resource_type text NOT NULL,
last_action_date date NOT NULL,
last_action_type text NOT NULL,
field_name text NOT NULL,
previous_value text NOT NULL,
replacement_value text NOT NULL,
updated_by text NOT NULL
);
ALTER TABLE public.metadata OWNER TO postgres;
--
-- Name: COLUMN metadata.id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.metadata.id IS 'The identifier for this metadata. Each entry must have a unique identifier.';
--
-- Name: COLUMN metadata.resource_id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.metadata.resource_id IS 'The identifier of the resource (service, program, location, address, or contact) that this metadata describes.';
--
-- Name: COLUMN metadata.resource_type; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.metadata.resource_type IS 'The type of entity being referenced.';
--
-- Name: COLUMN metadata.last_action_date; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.metadata.last_action_date IS 'The date when data was changed.';
--
-- Name: COLUMN metadata.last_action_type; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.metadata.last_action_type IS 'The kind of change made to the data.';
--
-- Name: COLUMN metadata.field_name; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.metadata.field_name IS 'The name of field that has been modified.';
--
-- Name: COLUMN metadata.previous_value; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.metadata.previous_value IS 'The previous value of the field that has been modified.';
--
-- Name: COLUMN metadata.replacement_value; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.metadata.replacement_value IS 'The new value of the field that has been modified.';
--
-- Name: COLUMN metadata.updated_by; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.metadata.updated_by IS 'The name of the person who modified the field.';
--
-- Name: organization; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.organization (
id character varying(250) NOT NULL,
name text NOT NULL,
alternate_name text,
description text NOT NULL,
email text,
website text,
tax_status text,
tax_id text,
year_incorporated numeric,
legal_status text,
logo text,
uri text,
parent_organization_id text
);
ALTER TABLE public.organization OWNER TO postgres;
--
-- Name: COLUMN organization.id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.organization.id IS 'The identifier for the organization. Each organization must have a unique identifier.';
--
-- Name: COLUMN organization.name; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.organization.name IS 'The official or public name of the organization.';
--
-- Name: COLUMN organization.alternate_name; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.organization.alternate_name IS 'An (optional) alternative or commonly used name for the organization.';
--
-- Name: COLUMN organization.description; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.organization.description IS 'A free text description containing a brief summary about the organization. It can contain markup such as HTML or Markdown.';
--
-- Name: COLUMN organization.email; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.organization.email IS 'The contact e-mail address for the organization.';
--
-- Name: COLUMN organization.website; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.organization.website IS 'The URL (website address) of the organization.';
--
-- Name: COLUMN organization.tax_status; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.organization.tax_status IS 'DEPRECATED: Government assigned tax designation for tax-exempt organizations.';
--
-- Name: COLUMN organization.tax_id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.organization.tax_id IS 'DEPRECATED: A government issued identifier used for the purpose of tax administration.';
--
-- Name: COLUMN organization.year_incorporated; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.organization.year_incorporated IS 'The year in which the organization was legally formed.';
--
-- Name: COLUMN organization.legal_status; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.organization.legal_status IS 'The legal conditions that an organization is operating under.';
--
-- Name: COLUMN organization.logo; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.organization.logo IS 'A URL to an image associated with the organization which can be presented alongside its name.';
--
-- Name: COLUMN organization.uri; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.organization.uri IS 'A persistent identifier to uniquely identify the organization such as those provided by Open Corporates or some other relevant URI provider. This is not for listing the website of the organization: that can be done through the website field of the Organization.';
--
-- Name: COLUMN organization.parent_organization_id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.organization.parent_organization_id IS 'The identifier of the organization''s parent organization.';
--
-- Name: organization_identifier; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.organization_identifier (
id character varying(250) NOT NULL,
organization_id character varying(250) NOT NULL,
identifier_scheme text,
identifier_type text NOT NULL,
identifier text NOT NULL
);
ALTER TABLE public.organization_identifier OWNER TO postgres;
--
-- Name: COLUMN organization_identifier.id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.organization_identifier.id IS 'The identifier for this organization identifier entry. Each entry must have a unique identifier.';
--
-- Name: COLUMN organization_identifier.organization_id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.organization_identifier.organization_id IS 'The identifier of the organization. This should match the uuid of an organization object.';
--
-- Name: COLUMN organization_identifier.identifier_scheme; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.organization_identifier.identifier_scheme IS 'The scheme of the third party identifier, according to http://org-id.guide/.';
--
-- Name: COLUMN organization_identifier.identifier_type; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.organization_identifier.identifier_type IS 'A human-readable equivalent of the identifier_scheme. This may be used in cases where org-id.guide does not list an appropriate identifier scheme.';
--
-- Name: COLUMN organization_identifier.identifier; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.organization_identifier.identifier IS 'The third-party identifier value.';
--
-- Name: phone; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.phone (
id character varying(250) NOT NULL,
location_id character varying(250),
service_id character varying(250),
organization_id character varying(250),
contact_id character varying(250),
service_at_location_id character varying(250),
number text NOT NULL,
extension numeric,
type text,
description text
);
ALTER TABLE public.phone OWNER TO postgres;
--
-- Name: COLUMN phone.id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.phone.id IS 'The identifier for the phone number. Each entry must have a unique identifier.';
--
-- Name: COLUMN phone.location_id; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON COLUMN public.phone.location_id IS 'The identifier of the location where this phone number is located.';
--
-- Name: COLUMN phone.service_id; Type: COMMENT; Schema: public; Owner: postgres
--