source: trunk/schema/schema.sql @ 1633

Last change on this file since 1633 was 543, checked in by keesvb, 10 years ago

added postgres database dump (0.2.5) to be able to track changes in database model

File size: 79.1 KB
Line 
1--
2-- PostgreSQL database dump
3--
4
5SET client_encoding = 'UNICODE';
6SET check_function_bodies = false;
7SET client_min_messages = warning;
8
9--
10-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres
11--
12
13COMMENT ON SCHEMA public IS 'Standard public schema';
14
15
16SET search_path = public, pg_catalog;
17
18SET default_tablespace = '';
19
20SET default_with_oids = true;
21
22--
23-- Name: _group; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
24--
25
26CREATE TABLE _group (
27    id bigint NOT NULL,
28    version bigint NOT NULL,
29    description character varying(255),
30    name character varying(255) NOT NULL,
31    last_updated timestamp without time zone,
32    date_created timestamp without time zone,
33    protect boolean NOT NULL
34);
35
36
37ALTER TABLE public._group OWNER TO gscf;
38
39--
40-- Name: _group_roles; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
41--
42
43CREATE TABLE _group_roles (
44    role_id bigint NOT NULL,
45    group_id bigint NOT NULL
46);
47
48
49ALTER TABLE public._group_roles OWNER TO gscf;
50
51--
52-- Name: _group_users; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
53--
54
55CREATE TABLE _group_users (
56    user_base_id bigint NOT NULL,
57    group_id bigint NOT NULL
58);
59
60
61ALTER TABLE public._group_users OWNER TO gscf;
62
63--
64-- Name: _role; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
65--
66
67CREATE TABLE _role (
68    id bigint NOT NULL,
69    version bigint NOT NULL,
70    description character varying(255),
71    name character varying(255) NOT NULL,
72    last_updated timestamp without time zone,
73    date_created timestamp without time zone,
74    protect boolean NOT NULL
75);
76
77
78ALTER TABLE public._role OWNER TO gscf;
79
80--
81-- Name: _role_users; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
82--
83
84CREATE TABLE _role_users (
85    user_base_id bigint NOT NULL,
86    role_id bigint NOT NULL
87);
88
89
90ALTER TABLE public._role_users OWNER TO gscf;
91
92--
93-- Name: _user; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
94--
95
96CREATE TABLE _user (
97    id bigint NOT NULL,
98    version bigint NOT NULL,
99    "external" boolean NOT NULL,
100    password_hash character varying(255),
101    remoteapi boolean NOT NULL,
102    username character varying(255) NOT NULL,
103    federated boolean NOT NULL,
104    action_hash character varying(255),
105    profile_id bigint NOT NULL,
106    enabled boolean NOT NULL,
107    expiration timestamp without time zone,
108    last_updated timestamp without time zone,
109    federation_provider_id bigint,
110    date_created timestamp without time zone,
111    "class" character varying(255) NOT NULL
112);
113
114
115ALTER TABLE public._user OWNER TO gscf;
116
117--
118-- Name: _user__user; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
119--
120
121CREATE TABLE _user__user (
122    user_base_follows_id bigint,
123    user_base_id bigint,
124    user_base_followers_id bigint
125);
126
127
128ALTER TABLE public._user__user OWNER TO gscf;
129
130--
131-- Name: _user_passwd_history; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
132--
133
134CREATE TABLE _user_passwd_history (
135    user_base_id bigint,
136    passwd_history_string character varying(255)
137);
138
139
140ALTER TABLE public._user_passwd_history OWNER TO gscf;
141
142--
143-- Name: address; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
144--
145
146CREATE TABLE address (
147    id bigint NOT NULL,
148    version bigint NOT NULL,
149    post_code character varying(255),
150    state character varying(255),
151    city character varying(255),
152    country character varying(255),
153    category character varying(255) NOT NULL,
154    suburb character varying(255),
155    owner_id bigint NOT NULL,
156    line1 character varying(255) NOT NULL,
157    line3 character varying(255),
158    line2 character varying(255)
159);
160
161
162ALTER TABLE public.address OWNER TO gscf;
163
164--
165-- Name: assay; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
166--
167
168CREATE TABLE assay (
169    id bigint NOT NULL,
170    version bigint NOT NULL,
171    module_id bigint NOT NULL,
172    name character varying(255) NOT NULL,
173    external_assayid bigint NOT NULL
174);
175
176
177ALTER TABLE public.assay OWNER TO gscf;
178
179--
180-- Name: assay_module; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
181--
182
183CREATE TABLE assay_module (
184    id bigint NOT NULL,
185    version bigint NOT NULL,
186    platform character varying(255) NOT NULL,
187    name character varying(255) NOT NULL,
188    "type" character varying(255) NOT NULL,
189    url character varying(255) NOT NULL
190);
191
192
193ALTER TABLE public.assay_module OWNER TO gscf;
194
195--
196-- Name: assay_sample; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
197--
198
199CREATE TABLE assay_sample (
200    assay_samples_id bigint,
201    sample_id bigint
202);
203
204
205ALTER TABLE public.assay_sample OWNER TO gscf;
206
207--
208-- Name: clinical_assay; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
209--
210
211CREATE TABLE clinical_assay (
212    id bigint NOT NULL,
213    version bigint NOT NULL,
214    approved boolean NOT NULL,
215    sop character varying(255),
216    name character varying(255) NOT NULL,
217    reference character varying(255),
218    applied_method character varying(255)
219);
220
221
222ALTER TABLE public.clinical_assay OWNER TO gscf;
223
224--
225-- Name: clinical_assay_clinical_measurement; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
226--
227
228CREATE TABLE clinical_assay_clinical_measurement (
229    clinical_assay_measurements_id bigint,
230    clinical_measurement_id bigint
231);
232
233
234ALTER TABLE public.clinical_assay_clinical_measurement OWNER TO gscf;
235
236--
237-- Name: clinical_assay_instance; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
238--
239
240CREATE TABLE clinical_assay_instance (
241    id bigint NOT NULL,
242    version bigint NOT NULL,
243    assay_id bigint NOT NULL
244);
245
246
247ALTER TABLE public.clinical_assay_instance OWNER TO gscf;
248
249--
250-- Name: clinical_float_data; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
251--
252
253CREATE TABLE clinical_float_data (
254    id bigint NOT NULL,
255    version bigint NOT NULL,
256    assay_id bigint NOT NULL,
257    value real NOT NULL,
258    sample character varying(255) NOT NULL,
259    measurement_id bigint NOT NULL
260);
261
262
263ALTER TABLE public.clinical_float_data OWNER TO gscf;
264
265--
266-- Name: clinical_string_data; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
267--
268
269CREATE TABLE clinical_string_data (
270    id bigint NOT NULL,
271    version bigint NOT NULL,
272    assayid bigint NOT NULL,
273    value real NOT NULL,
274    sampleid bigint NOT NULL,
275    measurement_id bigint NOT NULL
276);
277
278
279ALTER TABLE public.clinical_string_data OWNER TO gscf;
280
281--
282-- Name: compound; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
283--
284
285CREATE TABLE compound (
286    id bigint NOT NULL,
287    version bigint NOT NULL,
288    is_carrier boolean NOT NULL,
289    compound_id bigint,
290    dose_unit character varying(255),
291    name character varying(255) NOT NULL,
292    dose real NOT NULL
293);
294
295
296ALTER TABLE public.compound OWNER TO gscf;
297
298--
299-- Name: details; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
300--
301
302CREATE TABLE details (
303    id bigint NOT NULL,
304    version bigint NOT NULL,
305    logo character varying(255),
306    description character varying(255),
307    name character varying(255),
308    logo_small character varying(255),
309    display_name character varying(255),
310    url_id bigint
311);
312
313
314ALTER TABLE public.details OWNER TO gscf;
315
316--
317-- Name: encrypted_data; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
318--
319
320CREATE TABLE encrypted_data (
321    id character varying(32) NOT NULL,
322    version bigint NOT NULL,
323    data_item character varying(512) NOT NULL
324);
325
326
327ALTER TABLE public.encrypted_data OWNER TO gscf;
328
329--
330-- Name: event; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
331--
332
333CREATE TABLE event (
334    id bigint NOT NULL,
335    version bigint NOT NULL,
336    template_id bigint,
337    end_time bigint NOT NULL,
338    start_time bigint NOT NULL
339);
340
341
342ALTER TABLE public.event OWNER TO gscf;
343
344--
345-- Name: event_group; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
346--
347
348CREATE TABLE event_group (
349    id bigint NOT NULL,
350    version bigint NOT NULL,
351    name character varying(255) NOT NULL
352);
353
354
355ALTER TABLE public.event_group OWNER TO gscf;
356
357--
358-- Name: event_group_event; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
359--
360
361CREATE TABLE event_group_event (
362    event_group_events_id bigint,
363    event_id bigint
364);
365
366
367ALTER TABLE public.event_group_event OWNER TO gscf;
368
369--
370-- Name: event_group_subject; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
371--
372
373CREATE TABLE event_group_subject (
374    event_group_subjects_id bigint,
375    subject_id bigint
376);
377
378
379ALTER TABLE public.event_group_subject OWNER TO gscf;
380
381--
382-- Name: event_template_date_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
383--
384
385CREATE TABLE event_template_date_fields (
386    event_id bigint,
387    template_date_fields_date timestamp without time zone,
388    template_date_fields_idx character varying(255),
389    template_date_fields_elt timestamp without time zone NOT NULL
390);
391
392
393ALTER TABLE public.event_template_date_fields OWNER TO gscf;
394
395--
396-- Name: event_template_double_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
397--
398
399CREATE TABLE event_template_double_fields (
400    event_id bigint,
401    template_double_fields_double double precision,
402    template_double_fields_idx character varying(255),
403    template_double_fields_elt double precision NOT NULL
404);
405
406
407ALTER TABLE public.event_template_double_fields OWNER TO gscf;
408
409--
410-- Name: event_template_field; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
411--
412
413CREATE TABLE event_template_field (
414    event_system_fields_id bigint,
415    template_field_id bigint
416);
417
418
419ALTER TABLE public.event_template_field OWNER TO gscf;
420
421--
422-- Name: event_template_file_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
423--
424
425CREATE TABLE event_template_file_fields (
426    event_id bigint,
427    template_file_fields_string character varying(255),
428    template_file_fields_idx character varying(255),
429    template_file_fields_elt character varying(255) NOT NULL
430);
431
432
433ALTER TABLE public.event_template_file_fields OWNER TO gscf;
434
435--
436-- Name: event_template_float_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
437--
438
439CREATE TABLE event_template_float_fields (
440    event_id bigint,
441    template_float_fields_float real,
442    template_float_fields_idx character varying(255),
443    template_float_fields_elt real NOT NULL
444);
445
446
447ALTER TABLE public.event_template_float_fields OWNER TO gscf;
448
449--
450-- Name: event_template_integer_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
451--
452
453CREATE TABLE event_template_integer_fields (
454    event_id bigint,
455    template_integer_fields_int integer,
456    template_integer_fields_idx character varying(255),
457    template_integer_fields_elt integer NOT NULL
458);
459
460
461ALTER TABLE public.event_template_integer_fields OWNER TO gscf;
462
463--
464-- Name: event_template_rel_time_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
465--
466
467CREATE TABLE event_template_rel_time_fields (
468    event_id bigint,
469    template_rel_time_fields_long bigint,
470    template_rel_time_fields_idx character varying(255),
471    template_rel_time_fields_elt bigint NOT NULL
472);
473
474
475ALTER TABLE public.event_template_rel_time_fields OWNER TO gscf;
476
477--
478-- Name: event_template_string_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
479--
480
481CREATE TABLE event_template_string_fields (
482    event_id bigint,
483    template_string_fields_string character varying(255),
484    template_string_fields_idx character varying(255),
485    template_string_fields_elt character varying(255) NOT NULL
486);
487
488
489ALTER TABLE public.event_template_string_fields OWNER TO gscf;
490
491--
492-- Name: event_template_string_list_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
493--
494
495CREATE TABLE event_template_string_list_fields (
496    event_template_string_list_fields_id bigint,
497    template_field_list_item_id bigint,
498    template_string_list_fields_idx character varying(255)
499);
500
501
502ALTER TABLE public.event_template_string_list_fields OWNER TO gscf;
503
504--
505-- Name: event_template_term_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
506--
507
508CREATE TABLE event_template_term_fields (
509    event_template_term_fields_id bigint,
510    term_id bigint,
511    template_term_fields_idx character varying(255)
512);
513
514
515ALTER TABLE public.event_template_term_fields OWNER TO gscf;
516
517--
518-- Name: event_template_text_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
519--
520
521CREATE TABLE event_template_text_fields (
522    event_id bigint,
523    template_text_fields_string text,
524    template_text_fields_idx character varying(255),
525    template_text_fields_elt text NOT NULL
526);
527
528
529ALTER TABLE public.event_template_text_fields OWNER TO gscf;
530
531--
532-- Name: feature_base; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
533--
534
535CREATE TABLE feature_base (
536    id bigint NOT NULL,
537    version bigint NOT NULL,
538    "type" character varying(255) NOT NULL,
539    unit character varying(255) NOT NULL,
540    name character varying(255) NOT NULL,
541    "class" character varying(255) NOT NULL,
542    is_intake boolean,
543    is_drug boolean,
544    correction_method character varying(255),
545    detectable_limit real,
546    in_serum boolean,
547    reference_values character varying(255)
548);
549
550
551ALTER TABLE public.feature_base OWNER TO gscf;
552
553--
554-- Name: feature_base_term; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
555--
556
557CREATE TABLE feature_base_term (
558    feature_base_compound_id bigint,
559    term_id bigint,
560    feature_base_metabolite_id bigint,
561    feature_base_disease_id bigint,
562    feature_base_enzyme_id bigint,
563    feature_base_organism_part_id bigint,
564    feature_base_drug_id bigint
565);
566
567
568ALTER TABLE public.feature_base_term OWNER TO gscf;
569
570--
571-- Name: federation_provider; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
572--
573
574CREATE TABLE federation_provider (
575    id bigint NOT NULL,
576    version bigint NOT NULL,
577    uid character varying(255) NOT NULL,
578    details_id bigint NOT NULL,
579    auto_provision boolean NOT NULL
580);
581
582
583ALTER TABLE public.federation_provider OWNER TO gscf;
584
585--
586-- Name: federation_provider_props; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
587--
588
589CREATE TABLE federation_provider_props (
590    props bigint,
591    props_idx character varying(255),
592    props_elt character varying(255) NOT NULL
593);
594
595
596ALTER TABLE public.federation_provider_props OWNER TO gscf;
597
598--
599-- Name: feed; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
600--
601
602CREATE TABLE feed (
603    id bigint NOT NULL,
604    version bigint NOT NULL,
605    feed_url_id bigint NOT NULL,
606    details_id bigint NOT NULL
607);
608
609
610ALTER TABLE public.feed OWNER TO gscf;
611
612--
613-- Name: hibernate_sequence; Type: SEQUENCE; Schema: public; Owner: gscf
614--
615
616CREATE SEQUENCE hibernate_sequence
617    INCREMENT BY 1
618    NO MAXVALUE
619    NO MINVALUE
620    CACHE 1;
621
622
623ALTER TABLE public.hibernate_sequence OWNER TO gscf;
624
625--
626-- Name: import_mapping; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
627--
628
629CREATE TABLE import_mapping (
630    id bigint NOT NULL,
631    version bigint NOT NULL
632);
633
634
635ALTER TABLE public.import_mapping OWNER TO gscf;
636
637--
638-- Name: import_mapping_mapping_column; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
639--
640
641CREATE TABLE import_mapping_mapping_column (
642    import_mapping_columns_id bigint,
643    mapping_column_id bigint
644);
645
646
647ALTER TABLE public.import_mapping_mapping_column OWNER TO gscf;
648
649--
650-- Name: language; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
651--
652
653CREATE TABLE "language" (
654    id bigint NOT NULL,
655    version bigint NOT NULL,
656    scheme character varying(255) NOT NULL
657);
658
659
660ALTER TABLE public."language" OWNER TO gscf;
661
662--
663-- Name: language_codes; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
664--
665
666CREATE TABLE language_codes (
667    language_id bigint,
668    codes_string character varying(255)
669);
670
671
672ALTER TABLE public.language_codes OWNER TO gscf;
673
674--
675-- Name: level_permission_fifth; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
676--
677
678CREATE TABLE level_permission_fifth (
679    level_permission_id bigint,
680    fifth_string character varying(255)
681);
682
683
684ALTER TABLE public.level_permission_fifth OWNER TO gscf;
685
686--
687-- Name: level_permission_first; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
688--
689
690CREATE TABLE level_permission_first (
691    level_permission_id bigint,
692    first_string character varying(255)
693);
694
695
696ALTER TABLE public.level_permission_first OWNER TO gscf;
697
698--
699-- Name: level_permission_fourth; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
700--
701
702CREATE TABLE level_permission_fourth (
703    level_permission_id bigint,
704    fourth_string character varying(255)
705);
706
707
708ALTER TABLE public.level_permission_fourth OWNER TO gscf;
709
710--
711-- Name: level_permission_second; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
712--
713
714CREATE TABLE level_permission_second (
715    level_permission_id bigint,
716    second_string character varying(255)
717);
718
719
720ALTER TABLE public.level_permission_second OWNER TO gscf;
721
722--
723-- Name: level_permission_sixth; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
724--
725
726CREATE TABLE level_permission_sixth (
727    level_permission_id bigint,
728    sixth_string character varying(255)
729);
730
731
732ALTER TABLE public.level_permission_sixth OWNER TO gscf;
733
734--
735-- Name: level_permission_third; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
736--
737
738CREATE TABLE level_permission_third (
739    level_permission_id bigint,
740    third_string character varying(255)
741);
742
743
744ALTER TABLE public.level_permission_third OWNER TO gscf;
745
746--
747-- Name: login_record; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
748--
749
750CREATE TABLE login_record (
751    id bigint NOT NULL,
752    version bigint NOT NULL,
753    user_agent character varying(255) NOT NULL,
754    owner_id bigint NOT NULL,
755    last_updated timestamp without time zone,
756    date_created timestamp without time zone,
757    remote_host character varying(255) NOT NULL,
758    remote_addr character varying(255) NOT NULL
759);
760
761
762ALTER TABLE public.login_record OWNER TO gscf;
763
764--
765-- Name: mapping_column; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
766--
767
768CREATE TABLE mapping_column (
769    id bigint NOT NULL,
770    version bigint NOT NULL,
771    "index" integer NOT NULL,
772    name character varying(255) NOT NULL,
773    entity character varying(255) NOT NULL,
774    value character varying(255) NOT NULL,
775    templatefieldtype character varying(255) NOT NULL,
776    property character varying(255) NOT NULL,
777    identifier boolean NOT NULL
778);
779
780
781ALTER TABLE public.mapping_column OWNER TO gscf;
782
783--
784-- Name: ontology; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
785--
786
787CREATE TABLE ontology (
788    id bigint NOT NULL,
789    version bigint NOT NULL,
790    description character varying(255) NOT NULL,
791    name character varying(255) NOT NULL,
792    ncbo_versioned_id integer NOT NULL,
793    version_number character varying(255) NOT NULL,
794    url character varying(255) NOT NULL,
795    ncbo_id integer NOT NULL
796);
797
798
799ALTER TABLE public.ontology OWNER TO gscf;
800
801--
802-- Name: permission; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
803--
804
805CREATE TABLE permission (
806    id bigint NOT NULL,
807    version bigint NOT NULL,
808    "type" character varying(255) NOT NULL,
809    possible_actions character varying(255) NOT NULL,
810    managed boolean NOT NULL,
811    target character varying(255) NOT NULL,
812    role_id bigint,
813    group_id bigint,
814    user_id bigint,
815    actions character varying(255) NOT NULL,
816    "class" character varying(255) NOT NULL
817);
818
819
820ALTER TABLE public.permission OWNER TO gscf;
821
822--
823-- Name: person; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
824--
825
826CREATE TABLE person (
827    id bigint NOT NULL,
828    version bigint NOT NULL,
829    last_name character varying(255),
830    phone character varying(255),
831    fax character varying(255),
832    title character varying(255),
833    address character varying(255),
834    email character varying(255),
835    initials character varying(255),
836    prefix character varying(255),
837    gender character varying(255),
838    first_name character varying(255),
839    mobile character varying(255)
840);
841
842
843ALTER TABLE public.person OWNER TO gscf;
844
845--
846-- Name: person_affiliation; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
847--
848
849CREATE TABLE person_affiliation (
850    id bigint NOT NULL,
851    version bigint NOT NULL,
852    institute character varying(255) NOT NULL,
853    department character varying(255) NOT NULL
854);
855
856
857ALTER TABLE public.person_affiliation OWNER TO gscf;
858
859--
860-- Name: person_person_affiliation; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
861--
862
863CREATE TABLE person_person_affiliation (
864    person_affiliations_id bigint,
865    person_affiliation_id bigint
866);
867
868
869ALTER TABLE public.person_person_affiliation OWNER TO gscf;
870
871--
872-- Name: person_role; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
873--
874
875CREATE TABLE person_role (
876    id bigint NOT NULL,
877    version bigint NOT NULL,
878    name character varying(255) NOT NULL
879);
880
881
882ALTER TABLE public.person_role OWNER TO gscf;
883
884--
885-- Name: phone; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
886--
887
888CREATE TABLE phone (
889    id bigint NOT NULL,
890    version bigint NOT NULL,
891    owner_id bigint NOT NULL,
892    number character varying(255) NOT NULL,
893    "type" character varying(255) NOT NULL
894);
895
896
897ALTER TABLE public.phone OWNER TO gscf;
898
899--
900-- Name: profile_base; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
901--
902
903CREATE TABLE profile_base (
904    id bigint NOT NULL,
905    version bigint NOT NULL,
906    email_hash character varying(255),
907    nick_name character varying(255),
908    gravatar boolean NOT NULL,
909    gender character varying(255),
910    photo_type character varying(255),
911    last_updated timestamp without time zone,
912    current_status_id bigint,
913    photo bytea,
914    bio character varying(255),
915    email character varying(255),
916    dob timestamp without time zone,
917    date_created timestamp without time zone,
918    full_name character varying(255),
919    non_verified_email character varying(255),
920    "class" character varying(255) NOT NULL
921);
922
923
924ALTER TABLE public.profile_base OWNER TO gscf;
925
926--
927-- Name: profile_base_alternate_emails; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
928--
929
930CREATE TABLE profile_base_alternate_emails (
931    profile_base_id bigint,
932    alternate_emails_string character varying(255)
933);
934
935
936ALTER TABLE public.profile_base_alternate_emails OWNER TO gscf;
937
938--
939-- Name: profile_base_feed; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
940--
941
942CREATE TABLE profile_base_feed (
943    profile_base_feeds_id bigint,
944    feed_id bigint
945);
946
947
948ALTER TABLE public.profile_base_feed OWNER TO gscf;
949
950--
951-- Name: profile_base_url; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
952--
953
954CREATE TABLE profile_base_url (
955    profile_base_websites_id bigint,
956    url_id bigint
957);
958
959
960ALTER TABLE public.profile_base_url OWNER TO gscf;
961
962--
963-- Name: publication; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
964--
965
966CREATE TABLE publication (
967    id bigint NOT NULL,
968    version bigint NOT NULL,
969    title character varying(255) NOT NULL,
970    pub_medid character varying(255),
971    authors_list character varying(255),
972    doi character varying(255),
973    comments character varying(255)
974);
975
976
977ALTER TABLE public.publication OWNER TO gscf;
978
979--
980-- Name: rel_time; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
981--
982
983CREATE TABLE rel_time (
984    id bigint NOT NULL,
985    version bigint NOT NULL,
986    value bigint NOT NULL
987);
988
989
990ALTER TABLE public.rel_time OWNER TO gscf;
991
992--
993-- Name: sample; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
994--
995
996CREATE TABLE sample (
997    id bigint NOT NULL,
998    version bigint NOT NULL,
999    template_id bigint,
1000    parent_subject_id bigint,
1001    material_id bigint NOT NULL,
1002    parent_event_id bigint NOT NULL,
1003    name character varying(255) NOT NULL
1004);
1005
1006
1007ALTER TABLE public.sample OWNER TO gscf;
1008
1009--
1010-- Name: sample_template_date_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1011--
1012
1013CREATE TABLE sample_template_date_fields (
1014    sample_id bigint,
1015    template_date_fields_date timestamp without time zone,
1016    template_date_fields_idx character varying(255),
1017    template_date_fields_elt timestamp without time zone NOT NULL
1018);
1019
1020
1021ALTER TABLE public.sample_template_date_fields OWNER TO gscf;
1022
1023--
1024-- Name: sample_template_double_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1025--
1026
1027CREATE TABLE sample_template_double_fields (
1028    sample_id bigint,
1029    template_double_fields_double double precision,
1030    template_double_fields_idx character varying(255),
1031    template_double_fields_elt double precision NOT NULL
1032);
1033
1034
1035ALTER TABLE public.sample_template_double_fields OWNER TO gscf;
1036
1037--
1038-- Name: sample_template_field; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1039--
1040
1041CREATE TABLE sample_template_field (
1042    sample_system_fields_id bigint,
1043    template_field_id bigint
1044);
1045
1046
1047ALTER TABLE public.sample_template_field OWNER TO gscf;
1048
1049--
1050-- Name: sample_template_file_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1051--
1052
1053CREATE TABLE sample_template_file_fields (
1054    sample_id bigint,
1055    template_file_fields_string character varying(255),
1056    template_file_fields_idx character varying(255),
1057    template_file_fields_elt character varying(255) NOT NULL
1058);
1059
1060
1061ALTER TABLE public.sample_template_file_fields OWNER TO gscf;
1062
1063--
1064-- Name: sample_template_float_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1065--
1066
1067CREATE TABLE sample_template_float_fields (
1068    sample_id bigint,
1069    template_float_fields_float real,
1070    template_float_fields_idx character varying(255),
1071    template_float_fields_elt real NOT NULL
1072);
1073
1074
1075ALTER TABLE public.sample_template_float_fields OWNER TO gscf;
1076
1077--
1078-- Name: sample_template_integer_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1079--
1080
1081CREATE TABLE sample_template_integer_fields (
1082    sample_id bigint,
1083    template_integer_fields_int integer,
1084    template_integer_fields_idx character varying(255),
1085    template_integer_fields_elt integer NOT NULL
1086);
1087
1088
1089ALTER TABLE public.sample_template_integer_fields OWNER TO gscf;
1090
1091--
1092-- Name: sample_template_rel_time_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1093--
1094
1095CREATE TABLE sample_template_rel_time_fields (
1096    sample_id bigint,
1097    template_rel_time_fields_long bigint,
1098    template_rel_time_fields_idx character varying(255),
1099    template_rel_time_fields_elt bigint NOT NULL
1100);
1101
1102
1103ALTER TABLE public.sample_template_rel_time_fields OWNER TO gscf;
1104
1105--
1106-- Name: sample_template_string_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1107--
1108
1109CREATE TABLE sample_template_string_fields (
1110    sample_id bigint,
1111    template_string_fields_string character varying(255),
1112    template_string_fields_idx character varying(255),
1113    template_string_fields_elt character varying(255) NOT NULL
1114);
1115
1116
1117ALTER TABLE public.sample_template_string_fields OWNER TO gscf;
1118
1119--
1120-- Name: sample_template_string_list_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1121--
1122
1123CREATE TABLE sample_template_string_list_fields (
1124    sample_template_string_list_fields_id bigint,
1125    template_field_list_item_id bigint,
1126    template_string_list_fields_idx character varying(255)
1127);
1128
1129
1130ALTER TABLE public.sample_template_string_list_fields OWNER TO gscf;
1131
1132--
1133-- Name: sample_template_term_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1134--
1135
1136CREATE TABLE sample_template_term_fields (
1137    sample_template_term_fields_id bigint,
1138    term_id bigint,
1139    template_term_fields_idx character varying(255)
1140);
1141
1142
1143ALTER TABLE public.sample_template_term_fields OWNER TO gscf;
1144
1145--
1146-- Name: sample_template_text_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1147--
1148
1149CREATE TABLE sample_template_text_fields (
1150    sample_id bigint,
1151    template_text_fields_string text,
1152    template_text_fields_idx character varying(255),
1153    template_text_fields_elt text NOT NULL
1154);
1155
1156
1157ALTER TABLE public.sample_template_text_fields OWNER TO gscf;
1158
1159--
1160-- Name: sampling_event; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1161--
1162
1163CREATE TABLE sampling_event (
1164    id bigint NOT NULL
1165);
1166
1167
1168ALTER TABLE public.sampling_event OWNER TO gscf;
1169
1170--
1171-- Name: social_media_account; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1172--
1173
1174CREATE TABLE social_media_account (
1175    id bigint NOT NULL,
1176    version bigint NOT NULL,
1177    accountid character varying(255),
1178    username character varying(255),
1179    service_id bigint NOT NULL,
1180    owner_id bigint NOT NULL,
1181    profile_id bigint
1182);
1183
1184
1185ALTER TABLE public.social_media_account OWNER TO gscf;
1186
1187--
1188-- Name: social_media_account_feed; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1189--
1190
1191CREATE TABLE social_media_account_feed (
1192    social_media_account_feeds_id bigint,
1193    feed_id bigint
1194);
1195
1196
1197ALTER TABLE public.social_media_account_feed OWNER TO gscf;
1198
1199--
1200-- Name: social_media_account_url; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1201--
1202
1203CREATE TABLE social_media_account_url (
1204    social_media_account_urls_id bigint,
1205    url_id bigint
1206);
1207
1208
1209ALTER TABLE public.social_media_account_url OWNER TO gscf;
1210
1211--
1212-- Name: social_media_service; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1213--
1214
1215CREATE TABLE social_media_service (
1216    id bigint NOT NULL,
1217    version bigint NOT NULL,
1218    uid character varying(255) NOT NULL,
1219    base_profile_url_id bigint,
1220    details_id bigint NOT NULL
1221);
1222
1223
1224ALTER TABLE public.social_media_service OWNER TO gscf;
1225
1226--
1227-- Name: status; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1228--
1229
1230CREATE TABLE status (
1231    id bigint NOT NULL,
1232    version bigint NOT NULL,
1233    status character varying(255) NOT NULL,
1234    owner_id bigint NOT NULL,
1235    last_updated timestamp without time zone,
1236    date_created timestamp without time zone,
1237    url_id bigint
1238);
1239
1240
1241ALTER TABLE public.status OWNER TO gscf;
1242
1243--
1244-- Name: study; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1245--
1246
1247CREATE TABLE study (
1248    id bigint NOT NULL,
1249    version bigint NOT NULL,
1250    start_date timestamp without time zone NOT NULL,
1251    title character varying(255) NOT NULL,
1252    template_id bigint,
1253    last_updated timestamp without time zone NOT NULL,
1254    owner_id bigint,
1255    external_studyid bigint NOT NULL,
1256    date_created timestamp without time zone NOT NULL
1257);
1258
1259
1260ALTER TABLE public.study OWNER TO gscf;
1261
1262--
1263-- Name: study__user; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1264--
1265
1266CREATE TABLE study__user (
1267    study_editors_id bigint,
1268    user_id bigint,
1269    study_readers_id bigint
1270);
1271
1272
1273ALTER TABLE public.study__user OWNER TO gscf;
1274
1275--
1276-- Name: study_assay; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1277--
1278
1279CREATE TABLE study_assay (
1280    study_assays_id bigint,
1281    assay_id bigint
1282);
1283
1284
1285ALTER TABLE public.study_assay OWNER TO gscf;
1286
1287--
1288-- Name: study_event; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1289--
1290
1291CREATE TABLE study_event (
1292    study_events_id bigint,
1293    event_id bigint
1294);
1295
1296
1297ALTER TABLE public.study_event OWNER TO gscf;
1298
1299--
1300-- Name: study_event_group; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1301--
1302
1303CREATE TABLE study_event_group (
1304    study_event_groups_id bigint,
1305    event_group_id bigint
1306);
1307
1308
1309ALTER TABLE public.study_event_group OWNER TO gscf;
1310
1311--
1312-- Name: study_person; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1313--
1314
1315CREATE TABLE study_person (
1316    id bigint NOT NULL,
1317    version bigint NOT NULL,
1318    person_id bigint NOT NULL,
1319    role_id bigint NOT NULL
1320);
1321
1322
1323ALTER TABLE public.study_person OWNER TO gscf;
1324
1325--
1326-- Name: study_publication; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1327--
1328
1329CREATE TABLE study_publication (
1330    study_publications_id bigint,
1331    publication_id bigint
1332);
1333
1334
1335ALTER TABLE public.study_publication OWNER TO gscf;
1336
1337--
1338-- Name: study_sample; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1339--
1340
1341CREATE TABLE study_sample (
1342    study_samples_id bigint,
1343    sample_id bigint
1344);
1345
1346
1347ALTER TABLE public.study_sample OWNER TO gscf;
1348
1349--
1350-- Name: study_sampling_event; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1351--
1352
1353CREATE TABLE study_sampling_event (
1354    study_sampling_events_id bigint,
1355    sampling_event_id bigint
1356);
1357
1358
1359ALTER TABLE public.study_sampling_event OWNER TO gscf;
1360
1361--
1362-- Name: study_study_person; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1363--
1364
1365CREATE TABLE study_study_person (
1366    study_persons_id bigint,
1367    study_person_id bigint
1368);
1369
1370
1371ALTER TABLE public.study_study_person OWNER TO gscf;
1372
1373--
1374-- Name: study_subject; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1375--
1376
1377CREATE TABLE study_subject (
1378    study_subjects_id bigint,
1379    subject_id bigint
1380);
1381
1382
1383ALTER TABLE public.study_subject OWNER TO gscf;
1384
1385--
1386-- Name: study_template_date_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1387--
1388
1389CREATE TABLE study_template_date_fields (
1390    study_id bigint,
1391    template_date_fields_date timestamp without time zone,
1392    template_date_fields_idx character varying(255),
1393    template_date_fields_elt timestamp without time zone NOT NULL
1394);
1395
1396
1397ALTER TABLE public.study_template_date_fields OWNER TO gscf;
1398
1399--
1400-- Name: study_template_double_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1401--
1402
1403CREATE TABLE study_template_double_fields (
1404    study_id bigint,
1405    template_double_fields_double double precision,
1406    template_double_fields_idx character varying(255),
1407    template_double_fields_elt double precision NOT NULL
1408);
1409
1410
1411ALTER TABLE public.study_template_double_fields OWNER TO gscf;
1412
1413--
1414-- Name: study_template_field; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1415--
1416
1417CREATE TABLE study_template_field (
1418    study_system_fields_id bigint,
1419    template_field_id bigint
1420);
1421
1422
1423ALTER TABLE public.study_template_field OWNER TO gscf;
1424
1425--
1426-- Name: study_template_file_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1427--
1428
1429CREATE TABLE study_template_file_fields (
1430    study_id bigint,
1431    template_file_fields_string character varying(255),
1432    template_file_fields_idx character varying(255),
1433    template_file_fields_elt character varying(255) NOT NULL
1434);
1435
1436
1437ALTER TABLE public.study_template_file_fields OWNER TO gscf;
1438
1439--
1440-- Name: study_template_float_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1441--
1442
1443CREATE TABLE study_template_float_fields (
1444    study_id bigint,
1445    template_float_fields_float real,
1446    template_float_fields_idx character varying(255),
1447    template_float_fields_elt real NOT NULL
1448);
1449
1450
1451ALTER TABLE public.study_template_float_fields OWNER TO gscf;
1452
1453--
1454-- Name: study_template_integer_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1455--
1456
1457CREATE TABLE study_template_integer_fields (
1458    study_id bigint,
1459    template_integer_fields_int integer,
1460    template_integer_fields_idx character varying(255),
1461    template_integer_fields_elt integer NOT NULL
1462);
1463
1464
1465ALTER TABLE public.study_template_integer_fields OWNER TO gscf;
1466
1467--
1468-- Name: study_template_rel_time_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1469--
1470
1471CREATE TABLE study_template_rel_time_fields (
1472    study_id bigint,
1473    template_rel_time_fields_long bigint,
1474    template_rel_time_fields_idx character varying(255),
1475    template_rel_time_fields_elt bigint NOT NULL
1476);
1477
1478
1479ALTER TABLE public.study_template_rel_time_fields OWNER TO gscf;
1480
1481--
1482-- Name: study_template_string_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1483--
1484
1485CREATE TABLE study_template_string_fields (
1486    study_id bigint,
1487    template_string_fields_string character varying(255),
1488    template_string_fields_idx character varying(255),
1489    template_string_fields_elt character varying(255) NOT NULL
1490);
1491
1492
1493ALTER TABLE public.study_template_string_fields OWNER TO gscf;
1494
1495--
1496-- Name: study_template_string_list_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1497--
1498
1499CREATE TABLE study_template_string_list_fields (
1500    study_template_string_list_fields_id bigint,
1501    template_field_list_item_id bigint,
1502    template_string_list_fields_idx character varying(255)
1503);
1504
1505
1506ALTER TABLE public.study_template_string_list_fields OWNER TO gscf;
1507
1508--
1509-- Name: study_template_term_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1510--
1511
1512CREATE TABLE study_template_term_fields (
1513    study_template_term_fields_id bigint,
1514    term_id bigint,
1515    template_term_fields_idx character varying(255)
1516);
1517
1518
1519ALTER TABLE public.study_template_term_fields OWNER TO gscf;
1520
1521--
1522-- Name: study_template_text_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1523--
1524
1525CREATE TABLE study_template_text_fields (
1526    study_id bigint,
1527    template_text_fields_string character varying(255),
1528    template_text_fields_idx character varying(255),
1529    template_text_fields_elt character varying(255) NOT NULL
1530);
1531
1532
1533ALTER TABLE public.study_template_text_fields OWNER TO gscf;
1534
1535--
1536-- Name: subject; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1537--
1538
1539CREATE TABLE subject (
1540    id bigint NOT NULL,
1541    version bigint NOT NULL,
1542    template_id bigint,
1543    species_id bigint NOT NULL,
1544    name character varying(255) NOT NULL
1545);
1546
1547
1548ALTER TABLE public.subject OWNER TO gscf;
1549
1550--
1551-- Name: subject_template_date_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1552--
1553
1554CREATE TABLE subject_template_date_fields (
1555    subject_id bigint,
1556    template_date_fields_date timestamp without time zone,
1557    template_date_fields_idx character varying(255),
1558    template_date_fields_elt timestamp without time zone NOT NULL
1559);
1560
1561
1562ALTER TABLE public.subject_template_date_fields OWNER TO gscf;
1563
1564--
1565-- Name: subject_template_double_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1566--
1567
1568CREATE TABLE subject_template_double_fields (
1569    subject_id bigint,
1570    template_double_fields_double double precision,
1571    template_double_fields_idx character varying(255),
1572    template_double_fields_elt double precision NOT NULL
1573);
1574
1575
1576ALTER TABLE public.subject_template_double_fields OWNER TO gscf;
1577
1578--
1579-- Name: subject_template_field; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1580--
1581
1582CREATE TABLE subject_template_field (
1583    subject_system_fields_id bigint,
1584    template_field_id bigint
1585);
1586
1587
1588ALTER TABLE public.subject_template_field OWNER TO gscf;
1589
1590--
1591-- Name: subject_template_file_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1592--
1593
1594CREATE TABLE subject_template_file_fields (
1595    subject_id bigint,
1596    template_file_fields_string character varying(255),
1597    template_file_fields_idx character varying(255),
1598    template_file_fields_elt character varying(255) NOT NULL
1599);
1600
1601
1602ALTER TABLE public.subject_template_file_fields OWNER TO gscf;
1603
1604--
1605-- Name: subject_template_float_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1606--
1607
1608CREATE TABLE subject_template_float_fields (
1609    subject_id bigint,
1610    template_float_fields_float real,
1611    template_float_fields_idx character varying(255),
1612    template_float_fields_elt real NOT NULL
1613);
1614
1615
1616ALTER TABLE public.subject_template_float_fields OWNER TO gscf;
1617
1618--
1619-- Name: subject_template_integer_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1620--
1621
1622CREATE TABLE subject_template_integer_fields (
1623    subject_id bigint,
1624    template_integer_fields_int integer,
1625    template_integer_fields_idx character varying(255),
1626    template_integer_fields_elt integer NOT NULL
1627);
1628
1629
1630ALTER TABLE public.subject_template_integer_fields OWNER TO gscf;
1631
1632--
1633-- Name: subject_template_rel_time_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1634--
1635
1636CREATE TABLE subject_template_rel_time_fields (
1637    subject_id bigint,
1638    template_rel_time_fields_long bigint,
1639    template_rel_time_fields_idx character varying(255),
1640    template_rel_time_fields_elt bigint NOT NULL
1641);
1642
1643
1644ALTER TABLE public.subject_template_rel_time_fields OWNER TO gscf;
1645
1646--
1647-- Name: subject_template_string_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1648--
1649
1650CREATE TABLE subject_template_string_fields (
1651    subject_id bigint,
1652    template_string_fields_string character varying(255),
1653    template_string_fields_idx character varying(255),
1654    template_string_fields_elt character varying(255) NOT NULL
1655);
1656
1657
1658ALTER TABLE public.subject_template_string_fields OWNER TO gscf;
1659
1660--
1661-- Name: subject_template_string_list_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1662--
1663
1664CREATE TABLE subject_template_string_list_fields (
1665    subject_template_string_list_fields_id bigint,
1666    template_field_list_item_id bigint,
1667    template_string_list_fields_idx character varying(255)
1668);
1669
1670
1671ALTER TABLE public.subject_template_string_list_fields OWNER TO gscf;
1672
1673--
1674-- Name: subject_template_term_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1675--
1676
1677CREATE TABLE subject_template_term_fields (
1678    subject_template_term_fields_id bigint,
1679    term_id bigint,
1680    template_term_fields_idx character varying(255)
1681);
1682
1683
1684ALTER TABLE public.subject_template_term_fields OWNER TO gscf;
1685
1686--
1687-- Name: subject_template_text_fields; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1688--
1689
1690CREATE TABLE subject_template_text_fields (
1691    subject_id bigint,
1692    template_text_fields_string text,
1693    template_text_fields_idx character varying(255),
1694    template_text_fields_elt text NOT NULL
1695);
1696
1697
1698ALTER TABLE public.subject_template_text_fields OWNER TO gscf;
1699
1700--
1701-- Name: template; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1702--
1703
1704CREATE TABLE "template" (
1705    id bigint NOT NULL,
1706    version bigint NOT NULL,
1707    description character varying(255),
1708    name character varying(255) NOT NULL,
1709    entity character varying(255) NOT NULL
1710);
1711
1712
1713ALTER TABLE public."template" OWNER TO gscf;
1714
1715--
1716-- Name: template_field; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1717--
1718
1719CREATE TABLE template_field (
1720    id bigint NOT NULL,
1721    version bigint NOT NULL,
1722    unit character varying(255),
1723    preferred_identifier boolean NOT NULL,
1724    name character varying(255) NOT NULL,
1725    "type" character varying(255) NOT NULL,
1726    required boolean NOT NULL,
1727    "comment" text
1728);
1729
1730
1731ALTER TABLE public.template_field OWNER TO gscf;
1732
1733--
1734-- Name: template_field_list_item; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1735--
1736
1737CREATE TABLE template_field_list_item (
1738    id bigint NOT NULL,
1739    version bigint NOT NULL,
1740    name character varying(255) NOT NULL
1741);
1742
1743
1744ALTER TABLE public.template_field_list_item OWNER TO gscf;
1745
1746--
1747-- Name: template_field_ontology; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1748--
1749
1750CREATE TABLE template_field_ontology (
1751    template_field_ontologies_id bigint,
1752    ontology_id bigint
1753);
1754
1755
1756ALTER TABLE public.template_field_ontology OWNER TO gscf;
1757
1758--
1759-- Name: template_field_template_field_list_item; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1760--
1761
1762CREATE TABLE template_field_template_field_list_item (
1763    template_field_list_entries_id bigint,
1764    template_field_list_item_id bigint,
1765    list_entries_idx integer
1766);
1767
1768
1769ALTER TABLE public.template_field_template_field_list_item OWNER TO gscf;
1770
1771--
1772-- Name: template_template_field; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1773--
1774
1775CREATE TABLE template_template_field (
1776    template_fields_id bigint,
1777    template_field_id bigint,
1778    fields_idx integer
1779);
1780
1781
1782ALTER TABLE public.template_template_field OWNER TO gscf;
1783
1784--
1785-- Name: term; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1786--
1787
1788CREATE TABLE term (
1789    id bigint NOT NULL,
1790    version bigint NOT NULL,
1791    name character varying(255) NOT NULL,
1792    accession character varying(255) NOT NULL,
1793    ontology_id bigint NOT NULL
1794);
1795
1796
1797ALTER TABLE public.term OWNER TO gscf;
1798
1799--
1800-- Name: url; Type: TABLE; Schema: public; Owner: gscf; Tablespace:
1801--
1802
1803CREATE TABLE url (
1804    id bigint NOT NULL,
1805    version bigint NOT NULL,
1806    "location" character varying(255) NOT NULL,
1807    description character varying(255),
1808    name character varying(255),
1809    alt_text character varying(255),
1810    lang_id bigint
1811);
1812
1813
1814ALTER TABLE public.url OWNER TO gscf;
1815
1816--
1817-- Name: _group_name_key; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
1818--
1819
1820ALTER TABLE ONLY _group
1821    ADD CONSTRAINT _group_name_key UNIQUE (name);
1822
1823
1824ALTER INDEX public._group_name_key OWNER TO gscf;
1825
1826--
1827-- Name: _group_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
1828--
1829
1830ALTER TABLE ONLY _group
1831    ADD CONSTRAINT _group_pkey PRIMARY KEY (id);
1832
1833
1834ALTER INDEX public._group_pkey OWNER TO gscf;
1835
1836--
1837-- Name: _group_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
1838--
1839
1840ALTER TABLE ONLY _group_roles
1841    ADD CONSTRAINT _group_roles_pkey PRIMARY KEY (group_id, role_id);
1842
1843
1844ALTER INDEX public._group_roles_pkey OWNER TO gscf;
1845
1846--
1847-- Name: _group_users_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
1848--
1849
1850ALTER TABLE ONLY _group_users
1851    ADD CONSTRAINT _group_users_pkey PRIMARY KEY (group_id, user_base_id);
1852
1853
1854ALTER INDEX public._group_users_pkey OWNER TO gscf;
1855
1856--
1857-- Name: _role_name_key; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
1858--
1859
1860ALTER TABLE ONLY _role
1861    ADD CONSTRAINT _role_name_key UNIQUE (name);
1862
1863
1864ALTER INDEX public._role_name_key OWNER TO gscf;
1865
1866--
1867-- Name: _role_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
1868--
1869
1870ALTER TABLE ONLY _role
1871    ADD CONSTRAINT _role_pkey PRIMARY KEY (id);
1872
1873
1874ALTER INDEX public._role_pkey OWNER TO gscf;
1875
1876--
1877-- Name: _role_users_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
1878--
1879
1880ALTER TABLE ONLY _role_users
1881    ADD CONSTRAINT _role_users_pkey PRIMARY KEY (role_id, user_base_id);
1882
1883
1884ALTER INDEX public._role_users_pkey OWNER TO gscf;
1885
1886--
1887-- Name: _user_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
1888--
1889
1890ALTER TABLE ONLY _user
1891    ADD CONSTRAINT _user_pkey PRIMARY KEY (id);
1892
1893
1894ALTER INDEX public._user_pkey OWNER TO gscf;
1895
1896--
1897-- Name: _user_username_key; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
1898--
1899
1900ALTER TABLE ONLY _user
1901    ADD CONSTRAINT _user_username_key UNIQUE (username);
1902
1903
1904ALTER INDEX public._user_username_key OWNER TO gscf;
1905
1906--
1907-- Name: address_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
1908--
1909
1910ALTER TABLE ONLY address
1911    ADD CONSTRAINT address_pkey PRIMARY KEY (id);
1912
1913
1914ALTER INDEX public.address_pkey OWNER TO gscf;
1915
1916--
1917-- Name: assay_module_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
1918--
1919
1920ALTER TABLE ONLY assay_module
1921    ADD CONSTRAINT assay_module_pkey PRIMARY KEY (id);
1922
1923
1924ALTER INDEX public.assay_module_pkey OWNER TO gscf;
1925
1926--
1927-- Name: assay_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
1928--
1929
1930ALTER TABLE ONLY assay
1931    ADD CONSTRAINT assay_pkey PRIMARY KEY (id);
1932
1933
1934ALTER INDEX public.assay_pkey OWNER TO gscf;
1935
1936--
1937-- Name: clinical_assay_instance_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
1938--
1939
1940ALTER TABLE ONLY clinical_assay_instance
1941    ADD CONSTRAINT clinical_assay_instance_pkey PRIMARY KEY (id);
1942
1943
1944ALTER INDEX public.clinical_assay_instance_pkey OWNER TO gscf;
1945
1946--
1947-- Name: clinical_assay_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
1948--
1949
1950ALTER TABLE ONLY clinical_assay
1951    ADD CONSTRAINT clinical_assay_pkey PRIMARY KEY (id);
1952
1953
1954ALTER INDEX public.clinical_assay_pkey OWNER TO gscf;
1955
1956--
1957-- Name: clinical_float_data_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
1958--
1959
1960ALTER TABLE ONLY clinical_float_data
1961    ADD CONSTRAINT clinical_float_data_pkey PRIMARY KEY (id);
1962
1963
1964ALTER INDEX public.clinical_float_data_pkey OWNER TO gscf;
1965
1966--
1967-- Name: clinical_string_data_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
1968--
1969
1970ALTER TABLE ONLY clinical_string_data
1971    ADD CONSTRAINT clinical_string_data_pkey PRIMARY KEY (id);
1972
1973
1974ALTER INDEX public.clinical_string_data_pkey OWNER TO gscf;
1975
1976--
1977-- Name: compound_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
1978--
1979
1980ALTER TABLE ONLY compound
1981    ADD CONSTRAINT compound_pkey PRIMARY KEY (id);
1982
1983
1984ALTER INDEX public.compound_pkey OWNER TO gscf;
1985
1986--
1987-- Name: details_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
1988--
1989
1990ALTER TABLE ONLY details
1991    ADD CONSTRAINT details_pkey PRIMARY KEY (id);
1992
1993
1994ALTER INDEX public.details_pkey OWNER TO gscf;
1995
1996--
1997-- Name: encrypted_data_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
1998--
1999
2000ALTER TABLE ONLY encrypted_data
2001    ADD CONSTRAINT encrypted_data_pkey PRIMARY KEY (id);
2002
2003
2004ALTER INDEX public.encrypted_data_pkey OWNER TO gscf;
2005
2006--
2007-- Name: event_group_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2008--
2009
2010ALTER TABLE ONLY event_group
2011    ADD CONSTRAINT event_group_pkey PRIMARY KEY (id);
2012
2013
2014ALTER INDEX public.event_group_pkey OWNER TO gscf;
2015
2016--
2017-- Name: event_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2018--
2019
2020ALTER TABLE ONLY event
2021    ADD CONSTRAINT event_pkey PRIMARY KEY (id);
2022
2023
2024ALTER INDEX public.event_pkey OWNER TO gscf;
2025
2026--
2027-- Name: feature_base_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2028--
2029
2030ALTER TABLE ONLY feature_base
2031    ADD CONSTRAINT feature_base_pkey PRIMARY KEY (id);
2032
2033
2034ALTER INDEX public.feature_base_pkey OWNER TO gscf;
2035
2036--
2037-- Name: federation_provider_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2038--
2039
2040ALTER TABLE ONLY federation_provider
2041    ADD CONSTRAINT federation_provider_pkey PRIMARY KEY (id);
2042
2043
2044ALTER INDEX public.federation_provider_pkey OWNER TO gscf;
2045
2046--
2047-- Name: feed_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2048--
2049
2050ALTER TABLE ONLY feed
2051    ADD CONSTRAINT feed_pkey PRIMARY KEY (id);
2052
2053
2054ALTER INDEX public.feed_pkey OWNER TO gscf;
2055
2056--
2057-- Name: import_mapping_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2058--
2059
2060ALTER TABLE ONLY import_mapping
2061    ADD CONSTRAINT import_mapping_pkey PRIMARY KEY (id);
2062
2063
2064ALTER INDEX public.import_mapping_pkey OWNER TO gscf;
2065
2066--
2067-- Name: language_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2068--
2069
2070ALTER TABLE ONLY "language"
2071    ADD CONSTRAINT language_pkey PRIMARY KEY (id);
2072
2073
2074ALTER INDEX public.language_pkey OWNER TO gscf;
2075
2076--
2077-- Name: login_record_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2078--
2079
2080ALTER TABLE ONLY login_record
2081    ADD CONSTRAINT login_record_pkey PRIMARY KEY (id);
2082
2083
2084ALTER INDEX public.login_record_pkey OWNER TO gscf;
2085
2086--
2087-- Name: mapping_column_name_key; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2088--
2089
2090ALTER TABLE ONLY mapping_column
2091    ADD CONSTRAINT mapping_column_name_key UNIQUE (name);
2092
2093
2094ALTER INDEX public.mapping_column_name_key OWNER TO gscf;
2095
2096--
2097-- Name: mapping_column_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2098--
2099
2100ALTER TABLE ONLY mapping_column
2101    ADD CONSTRAINT mapping_column_pkey PRIMARY KEY (id);
2102
2103
2104ALTER INDEX public.mapping_column_pkey OWNER TO gscf;
2105
2106--
2107-- Name: ontology_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2108--
2109
2110ALTER TABLE ONLY ontology
2111    ADD CONSTRAINT ontology_pkey PRIMARY KEY (id);
2112
2113
2114ALTER INDEX public.ontology_pkey OWNER TO gscf;
2115
2116--
2117-- Name: permission_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2118--
2119
2120ALTER TABLE ONLY permission
2121    ADD CONSTRAINT permission_pkey PRIMARY KEY (id);
2122
2123
2124ALTER INDEX public.permission_pkey OWNER TO gscf;
2125
2126--
2127-- Name: person_affiliation_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2128--
2129
2130ALTER TABLE ONLY person_affiliation
2131    ADD CONSTRAINT person_affiliation_pkey PRIMARY KEY (id);
2132
2133
2134ALTER INDEX public.person_affiliation_pkey OWNER TO gscf;
2135
2136--
2137-- Name: person_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2138--
2139
2140ALTER TABLE ONLY person
2141    ADD CONSTRAINT person_pkey PRIMARY KEY (id);
2142
2143
2144ALTER INDEX public.person_pkey OWNER TO gscf;
2145
2146--
2147-- Name: person_role_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2148--
2149
2150ALTER TABLE ONLY person_role
2151    ADD CONSTRAINT person_role_pkey PRIMARY KEY (id);
2152
2153
2154ALTER INDEX public.person_role_pkey OWNER TO gscf;
2155
2156--
2157-- Name: phone_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2158--
2159
2160ALTER TABLE ONLY phone
2161    ADD CONSTRAINT phone_pkey PRIMARY KEY (id);
2162
2163
2164ALTER INDEX public.phone_pkey OWNER TO gscf;
2165
2166--
2167-- Name: profile_base_email_key; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2168--
2169
2170ALTER TABLE ONLY profile_base
2171    ADD CONSTRAINT profile_base_email_key UNIQUE (email);
2172
2173
2174ALTER INDEX public.profile_base_email_key OWNER TO gscf;
2175
2176--
2177-- Name: profile_base_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2178--
2179
2180ALTER TABLE ONLY profile_base
2181    ADD CONSTRAINT profile_base_pkey PRIMARY KEY (id);
2182
2183
2184ALTER INDEX public.profile_base_pkey OWNER TO gscf;
2185
2186--
2187-- Name: publication_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2188--
2189
2190ALTER TABLE ONLY publication
2191    ADD CONSTRAINT publication_pkey PRIMARY KEY (id);
2192
2193
2194ALTER INDEX public.publication_pkey OWNER TO gscf;
2195
2196--
2197-- Name: rel_time_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2198--
2199
2200ALTER TABLE ONLY rel_time
2201    ADD CONSTRAINT rel_time_pkey PRIMARY KEY (id);
2202
2203
2204ALTER INDEX public.rel_time_pkey OWNER TO gscf;
2205
2206--
2207-- Name: sample_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2208--
2209
2210ALTER TABLE ONLY sample
2211    ADD CONSTRAINT sample_pkey PRIMARY KEY (id);
2212
2213
2214ALTER INDEX public.sample_pkey OWNER TO gscf;
2215
2216--
2217-- Name: sampling_event_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2218--
2219
2220ALTER TABLE ONLY sampling_event
2221    ADD CONSTRAINT sampling_event_pkey PRIMARY KEY (id);
2222
2223
2224ALTER INDEX public.sampling_event_pkey OWNER TO gscf;
2225
2226--
2227-- Name: social_media_account_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2228--
2229
2230ALTER TABLE ONLY social_media_account
2231    ADD CONSTRAINT social_media_account_pkey PRIMARY KEY (id);
2232
2233
2234ALTER INDEX public.social_media_account_pkey OWNER TO gscf;
2235
2236--
2237-- Name: social_media_service_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2238--
2239
2240ALTER TABLE ONLY social_media_service
2241    ADD CONSTRAINT social_media_service_pkey PRIMARY KEY (id);
2242
2243
2244ALTER INDEX public.social_media_service_pkey OWNER TO gscf;
2245
2246--
2247-- Name: status_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2248--
2249
2250ALTER TABLE ONLY status
2251    ADD CONSTRAINT status_pkey PRIMARY KEY (id);
2252
2253
2254ALTER INDEX public.status_pkey OWNER TO gscf;
2255
2256--
2257-- Name: study_person_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2258--
2259
2260ALTER TABLE ONLY study_person
2261    ADD CONSTRAINT study_person_pkey PRIMARY KEY (id);
2262
2263
2264ALTER INDEX public.study_person_pkey OWNER TO gscf;
2265
2266--
2267-- Name: study_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2268--
2269
2270ALTER TABLE ONLY study
2271    ADD CONSTRAINT study_pkey PRIMARY KEY (id);
2272
2273
2274ALTER INDEX public.study_pkey OWNER TO gscf;
2275
2276--
2277-- Name: subject_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2278--
2279
2280ALTER TABLE ONLY subject
2281    ADD CONSTRAINT subject_pkey PRIMARY KEY (id);
2282
2283
2284ALTER INDEX public.subject_pkey OWNER TO gscf;
2285
2286--
2287-- Name: template_field_list_item_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2288--
2289
2290ALTER TABLE ONLY template_field_list_item
2291    ADD CONSTRAINT template_field_list_item_pkey PRIMARY KEY (id);
2292
2293
2294ALTER INDEX public.template_field_list_item_pkey OWNER TO gscf;
2295
2296--
2297-- Name: template_field_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2298--
2299
2300ALTER TABLE ONLY template_field
2301    ADD CONSTRAINT template_field_pkey PRIMARY KEY (id);
2302
2303
2304ALTER INDEX public.template_field_pkey OWNER TO gscf;
2305
2306--
2307-- Name: template_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2308--
2309
2310ALTER TABLE ONLY "template"
2311    ADD CONSTRAINT template_pkey PRIMARY KEY (id);
2312
2313
2314ALTER INDEX public.template_pkey OWNER TO gscf;
2315
2316--
2317-- Name: term_ontology_id_key; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2318--
2319
2320ALTER TABLE ONLY term
2321    ADD CONSTRAINT term_ontology_id_key UNIQUE (ontology_id, accession);
2322
2323
2324ALTER INDEX public.term_ontology_id_key OWNER TO gscf;
2325
2326--
2327-- Name: term_ontology_id_key1; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2328--
2329
2330ALTER TABLE ONLY term
2331    ADD CONSTRAINT term_ontology_id_key1 UNIQUE (ontology_id, name);
2332
2333
2334ALTER INDEX public.term_ontology_id_key1 OWNER TO gscf;
2335
2336--
2337-- Name: term_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2338--
2339
2340ALTER TABLE ONLY term
2341    ADD CONSTRAINT term_pkey PRIMARY KEY (id);
2342
2343
2344ALTER INDEX public.term_pkey OWNER TO gscf;
2345
2346--
2347-- Name: url_pkey; Type: CONSTRAINT; Schema: public; Owner: gscf; Tablespace:
2348--
2349
2350ALTER TABLE ONLY url
2351    ADD CONSTRAINT url_pkey PRIMARY KEY (id);
2352
2353
2354ALTER INDEX public.url_pkey OWNER TO gscf;
2355
2356--
2357-- Name: fk14e7a8b6de1700f4; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2358--
2359
2360ALTER TABLE ONLY study_publication
2361    ADD CONSTRAINT fk14e7a8b6de1700f4 FOREIGN KEY (publication_id) REFERENCES publication(id);
2362
2363
2364--
2365-- Name: fk14e7a8b6f25e0620; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2366--
2367
2368ALTER TABLE ONLY study_publication
2369    ADD CONSTRAINT fk14e7a8b6f25e0620 FOREIGN KEY (study_publications_id) REFERENCES study(id);
2370
2371
2372--
2373-- Name: fk16000e0bd3a394a; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2374--
2375
2376ALTER TABLE ONLY study_sample
2377    ADD CONSTRAINT fk16000e0bd3a394a FOREIGN KEY (study_samples_id) REFERENCES study(id);
2378
2379
2380--
2381-- Name: fk16000e0cbf5fe80; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2382--
2383
2384ALTER TABLE ONLY study_sample
2385    ADD CONSTRAINT fk16000e0cbf5fe80 FOREIGN KEY (sample_id) REFERENCES sample(id);
2386
2387
2388--
2389-- Name: fk1c56f208902c6; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2390--
2391
2392ALTER TABLE ONLY url
2393    ADD CONSTRAINT fk1c56f208902c6 FOREIGN KEY (lang_id) REFERENCES "language"(id);
2394
2395
2396--
2397-- Name: fk1c8b2b3e123bda38; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2398--
2399
2400ALTER TABLE ONLY _group_roles
2401    ADD CONSTRAINT fk1c8b2b3e123bda38 FOREIGN KEY (group_id) REFERENCES _group(id);
2402
2403
2404--
2405-- Name: fk1c8b2b3eac8a955c; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2406--
2407
2408ALTER TABLE ONLY _group_roles
2409    ADD CONSTRAINT fk1c8b2b3eac8a955c FOREIGN KEY (role_id) REFERENCES _role(id);
2410
2411
2412--
2413-- Name: fk1cb72a89123bda38; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2414--
2415
2416ALTER TABLE ONLY _group_users
2417    ADD CONSTRAINT fk1cb72a89123bda38 FOREIGN KEY (group_id) REFERENCES _group(id);
2418
2419
2420--
2421-- Name: fk1cb72a89bb02cc73; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2422--
2423
2424ALTER TABLE ONLY _group_users
2425    ADD CONSTRAINT fk1cb72a89bb02cc73 FOREIGN KEY (user_base_id) REFERENCES _user(id);
2426
2427
2428--
2429-- Name: fk25943b6d33e6dfd8; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2430--
2431
2432ALTER TABLE ONLY federation_provider
2433    ADD CONSTRAINT fk25943b6d33e6dfd8 FOREIGN KEY (details_id) REFERENCES details(id);
2434
2435
2436--
2437-- Name: fk2aa86afd2046a45c; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2438--
2439
2440ALTER TABLE ONLY social_media_account_feed
2441    ADD CONSTRAINT fk2aa86afd2046a45c FOREIGN KEY (feed_id) REFERENCES feed(id);
2442
2443
2444--
2445-- Name: fk2aa86afdb9eec27c; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2446--
2447
2448ALTER TABLE ONLY social_media_account_feed
2449    ADD CONSTRAINT fk2aa86afdb9eec27c FOREIGN KEY (social_media_account_feeds_id) REFERENCES social_media_account(id);
2450
2451
2452--
2453-- Name: fk2fe59e33e6dfd8; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2454--
2455
2456ALTER TABLE ONLY feed
2457    ADD CONSTRAINT fk2fe59e33e6dfd8 FOREIGN KEY (details_id) REFERENCES details(id);
2458
2459
2460--
2461-- Name: fk2fe59e8c1dfd79; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2462--
2463
2464ALTER TABLE ONLY feed
2465    ADD CONSTRAINT fk2fe59e8c1dfd79 FOREIGN KEY (feed_url_id) REFERENCES url(id);
2466
2467
2468--
2469-- Name: fk36446ca83f7e90; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2470--
2471
2472ALTER TABLE ONLY term
2473    ADD CONSTRAINT fk36446ca83f7e90 FOREIGN KEY (ontology_id) REFERENCES ontology(id);
2474
2475
2476--
2477-- Name: fk37d7f15922f11b7d; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2478--
2479
2480ALTER TABLE ONLY template_field_ontology
2481    ADD CONSTRAINT fk37d7f15922f11b7d FOREIGN KEY (template_field_ontologies_id) REFERENCES template_field(id);
2482
2483
2484--
2485-- Name: fk37d7f159a83f7e90; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2486--
2487
2488ALTER TABLE ONLY template_field_ontology
2489    ADD CONSTRAINT fk37d7f159a83f7e90 FOREIGN KEY (ontology_id) REFERENCES ontology(id);
2490
2491
2492--
2493-- Name: fk3ad8eb5a1953ed7f; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2494--
2495
2496ALTER TABLE ONLY template_template_field
2497    ADD CONSTRAINT fk3ad8eb5a1953ed7f FOREIGN KEY (template_field_id) REFERENCES template_field(id);
2498
2499
2500--
2501-- Name: fk3c9d7e30cbf5fe80; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2502--
2503
2504ALTER TABLE ONLY assay_sample
2505    ADD CONSTRAINT fk3c9d7e30cbf5fe80 FOREIGN KEY (sample_id) REFERENCES sample(id);
2506
2507
2508--
2509-- Name: fk3c9d7e30f6da6b4a; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2510--
2511
2512ALTER TABLE ONLY assay_sample
2513    ADD CONSTRAINT fk3c9d7e30f6da6b4a FOREIGN KEY (assay_samples_id) REFERENCES assay(id);
2514
2515
2516--
2517-- Name: fk3ce43f4264f45c34; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2518--
2519
2520ALTER TABLE ONLY clinical_assay_clinical_measurement
2521    ADD CONSTRAINT fk3ce43f4264f45c34 FOREIGN KEY (clinical_assay_measurements_id) REFERENCES clinical_assay(id);
2522
2523
2524--
2525-- Name: fk3ce43f42a1cebcf0; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2526--
2527
2528ALTER TABLE ONLY clinical_assay_clinical_measurement
2529    ADD CONSTRAINT fk3ce43f42a1cebcf0 FOREIGN KEY (clinical_measurement_id) REFERENCES feature_base(id);
2530
2531
2532--
2533-- Name: fk40e2022b1953ed7f; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2534--
2535
2536ALTER TABLE ONLY study_template_field
2537    ADD CONSTRAINT fk40e2022b1953ed7f FOREIGN KEY (template_field_id) REFERENCES template_field(id);
2538
2539
2540--
2541-- Name: fk40e2022b469f7a0a; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2542--
2543
2544ALTER TABLE ONLY study_template_field
2545    ADD CONSTRAINT fk40e2022b469f7a0a FOREIGN KEY (study_system_fields_id) REFERENCES study(id);
2546
2547
2548--
2549-- Name: fk4198d1782ad5a965; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2550--
2551
2552ALTER TABLE ONLY study_sampling_event
2553    ADD CONSTRAINT fk4198d1782ad5a965 FOREIGN KEY (sampling_event_id) REFERENCES sampling_event(id);
2554
2555
2556--
2557-- Name: fk4198d1789ce8fde2; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2558--
2559
2560ALTER TABLE ONLY study_sampling_event
2561    ADD CONSTRAINT fk4198d1789ce8fde2 FOREIGN KEY (study_sampling_events_id) REFERENCES study(id);
2562
2563
2564--
2565-- Name: fk48ead7a78f873816; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2566--
2567
2568ALTER TABLE ONLY profile_base
2569    ADD CONSTRAINT fk48ead7a78f873816 FOREIGN KEY (current_status_id) REFERENCES status(id);
2570
2571
2572--
2573-- Name: fk4c2330b690958e20; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2574--
2575
2576ALTER TABLE ONLY study_subject
2577    ADD CONSTRAINT fk4c2330b690958e20 FOREIGN KEY (study_subjects_id) REFERENCES study(id);
2578
2579
2580--
2581-- Name: fk4c2330b6a98e8df4; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2582--
2583
2584ALTER TABLE ONLY study_subject
2585    ADD CONSTRAINT fk4c2330b6a98e8df4 FOREIGN KEY (subject_id) REFERENCES subject(id);
2586
2587
2588--
2589-- Name: fk4cd0f1416021e487; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2590--
2591
2592ALTER TABLE ONLY study_study_person
2593    ADD CONSTRAINT fk4cd0f1416021e487 FOREIGN KEY (study_person_id) REFERENCES study_person(id);
2594
2595
2596--
2597-- Name: fk4cd0f141dd259175; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2598--
2599
2600ALTER TABLE ONLY study_study_person
2601    ADD CONSTRAINT fk4cd0f141dd259175 FOREIGN KEY (study_persons_id) REFERENCES study(id);
2602
2603
2604--
2605-- Name: fk4d4a8681953ed7f; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2606--
2607
2608ALTER TABLE ONLY subject_template_field
2609    ADD CONSTRAINT fk4d4a8681953ed7f FOREIGN KEY (template_field_id) REFERENCES template_field(id);
2610
2611
2612--
2613-- Name: fk4d4a86844f125ea; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2614--
2615
2616ALTER TABLE ONLY subject_template_field
2617    ADD CONSTRAINT fk4d4a86844f125ea FOREIGN KEY (subject_system_fields_id) REFERENCES subject(id);
2618
2619
2620--
2621-- Name: fk4f5e54592dcc7e59; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2622--
2623
2624ALTER TABLE ONLY clinical_float_data
2625    ADD CONSTRAINT fk4f5e54592dcc7e59 FOREIGN KEY (assay_id) REFERENCES clinical_assay_instance(id);
2626
2627
2628--
2629-- Name: fk4f5e5459c4f3e44; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2630--
2631
2632ALTER TABLE ONLY clinical_float_data
2633    ADD CONSTRAINT fk4f5e5459c4f3e44 FOREIGN KEY (measurement_id) REFERENCES feature_base(id);
2634
2635
2636--
2637-- Name: fk540247fdd8d911c; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2638--
2639
2640ALTER TABLE ONLY language_codes
2641    ADD CONSTRAINT fk540247fdd8d911c FOREIGN KEY (language_id) REFERENCES "language"(id);
2642
2643
2644--
2645-- Name: fk571a4aa66a8f1e9; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2646--
2647
2648ALTER TABLE ONLY _user
2649    ADD CONSTRAINT fk571a4aa66a8f1e9 FOREIGN KEY (profile_id) REFERENCES profile_base(id);
2650
2651
2652--
2653-- Name: fk571a4aaa84cbd63; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2654--
2655
2656ALTER TABLE ONLY _user
2657    ADD CONSTRAINT fk571a4aaa84cbd63 FOREIGN KEY (federation_provider_id) REFERENCES federation_provider(id);
2658
2659
2660--
2661-- Name: fk58cea793ef1f0cd; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2662--
2663
2664ALTER TABLE ONLY assay
2665    ADD CONSTRAINT fk58cea793ef1f0cd FOREIGN KEY (module_id) REFERENCES assay_module(id);
2666
2667
2668--
2669-- Name: fk5c6729a4247a300; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2670--
2671
2672ALTER TABLE ONLY event
2673    ADD CONSTRAINT fk5c6729a4247a300 FOREIGN KEY (template_id) REFERENCES "template"(id);
2674
2675
2676--
2677-- Name: fk5cd8f242239fd3b8; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2678--
2679
2680ALTER TABLE ONLY details
2681    ADD CONSTRAINT fk5cd8f242239fd3b8 FOREIGN KEY (url_id) REFERENCES url(id);
2682
2683
2684--
2685-- Name: fk5eb5768fcab6b3e1; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2686--
2687
2688ALTER TABLE ONLY level_permission_fourth
2689    ADD CONSTRAINT fk5eb5768fcab6b3e1 FOREIGN KEY (level_permission_id) REFERENCES permission(id);
2690
2691
2692--
2693-- Name: fk607d35542140fb2b; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2694--
2695
2696ALTER TABLE ONLY profile_base_alternate_emails
2697    ADD CONSTRAINT fk607d35542140fb2b FOREIGN KEY (profile_base_id) REFERENCES profile_base(id);
2698
2699
2700--
2701-- Name: fk65b3d6eb83749f; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2702--
2703
2704ALTER TABLE ONLY phone
2705    ADD CONSTRAINT fk65b3d6eb83749f FOREIGN KEY (owner_id) REFERENCES profile_base(id);
2706
2707
2708--
2709-- Name: fk68b0dc94247a300; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2710--
2711
2712ALTER TABLE ONLY study
2713    ADD CONSTRAINT fk68b0dc94247a300 FOREIGN KEY (template_id) REFERENCES "template"(id);
2714
2715
2716--
2717-- Name: fk68b0dc9750752d7; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2718--
2719
2720ALTER TABLE ONLY study
2721    ADD CONSTRAINT fk68b0dc9750752d7 FOREIGN KEY (owner_id) REFERENCES _user(id);
2722
2723
2724--
2725-- Name: fk6c251e301549da89; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2726--
2727
2728ALTER TABLE ONLY person_person_affiliation
2729    ADD CONSTRAINT fk6c251e301549da89 FOREIGN KEY (person_affiliation_id) REFERENCES person_affiliation(id);
2730
2731
2732--
2733-- Name: fk6c251e306dd0eac8; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2734--
2735
2736ALTER TABLE ONLY person_person_affiliation
2737    ADD CONSTRAINT fk6c251e306dd0eac8 FOREIGN KEY (person_affiliations_id) REFERENCES person(id);
2738
2739
2740--
2741-- Name: fk6f51f72458ff6d8e; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2742--
2743
2744ALTER TABLE ONLY study_event_group
2745    ADD CONSTRAINT fk6f51f72458ff6d8e FOREIGN KEY (study_event_groups_id) REFERENCES study(id);
2746
2747
2748--
2749-- Name: fk6f51f724aa6618eb; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2750--
2751
2752ALTER TABLE ONLY study_event_group
2753    ADD CONSTRAINT fk6f51f724aa6618eb FOREIGN KEY (event_group_id) REFERENCES event_group(id);
2754
2755
2756--
2757-- Name: fk744f50e9cab6b3e1; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2758--
2759
2760ALTER TABLE ONLY level_permission_second
2761    ADD CONSTRAINT fk744f50e9cab6b3e1 FOREIGN KEY (level_permission_id) REFERENCES permission(id);
2762
2763
2764--
2765-- Name: fk7c546ab56f1f15b4; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2766--
2767
2768ALTER TABLE ONLY event_group_event
2769    ADD CONSTRAINT fk7c546ab56f1f15b4 FOREIGN KEY (event_id) REFERENCES event(id);
2770
2771
2772--
2773-- Name: fk7c546ab5d78656a7; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2774--
2775
2776ALTER TABLE ONLY event_group_event
2777    ADD CONSTRAINT fk7c546ab5d78656a7 FOREIGN KEY (event_group_events_id) REFERENCES event_group(id);
2778
2779
2780--
2781-- Name: fk8dc39830239fd3b8; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2782--
2783
2784ALTER TABLE ONLY social_media_account_url
2785    ADD CONSTRAINT fk8dc39830239fd3b8 FOREIGN KEY (url_id) REFERENCES url(id);
2786
2787
2788--
2789-- Name: fk8dc39830947a1e2f; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2790--
2791
2792ALTER TABLE ONLY social_media_account_url
2793    ADD CONSTRAINT fk8dc39830947a1e2f FOREIGN KEY (social_media_account_urls_id) REFERENCES social_media_account(id);
2794
2795
2796--
2797-- Name: fk90aa552c4247a300; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2798--
2799
2800ALTER TABLE ONLY subject
2801    ADD CONSTRAINT fk90aa552c4247a300 FOREIGN KEY (template_id) REFERENCES "template"(id);
2802
2803
2804--
2805-- Name: fk90aa552c8cb6e9a0; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2806--
2807
2808ALTER TABLE ONLY subject
2809    ADD CONSTRAINT fk90aa552c8cb6e9a0 FOREIGN KEY (species_id) REFERENCES term(id);
2810
2811
2812--
2813-- Name: fk939fdab457ed4b8d; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2814--
2815
2816ALTER TABLE ONLY study__user
2817    ADD CONSTRAINT fk939fdab457ed4b8d FOREIGN KEY (study_editors_id) REFERENCES study(id);
2818
2819
2820--
2821-- Name: fk939fdab4920a2bf; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2822--
2823
2824ALTER TABLE ONLY study__user
2825    ADD CONSTRAINT fk939fdab4920a2bf FOREIGN KEY (user_id) REFERENCES _user(id);
2826
2827
2828--
2829-- Name: fk939fdab4b56ee7e3; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2830--
2831
2832ALTER TABLE ONLY study__user
2833    ADD CONSTRAINT fk939fdab4b56ee7e3 FOREIGN KEY (study_readers_id) REFERENCES study(id);
2834
2835
2836--
2837-- Name: fk93bb208347dd1554; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2838--
2839
2840ALTER TABLE ONLY study_assay
2841    ADD CONSTRAINT fk93bb208347dd1554 FOREIGN KEY (assay_id) REFERENCES assay(id);
2842
2843
2844--
2845-- Name: fk93bb208367e6cf6d; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2846--
2847
2848ALTER TABLE ONLY study_assay
2849    ADD CONSTRAINT fk93bb208367e6cf6d FOREIGN KEY (study_assays_id) REFERENCES study(id);
2850
2851
2852--
2853-- Name: fk93f4a8a421ed5f0e; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2854--
2855
2856ALTER TABLE ONLY study_event
2857    ADD CONSTRAINT fk93f4a8a421ed5f0e FOREIGN KEY (study_events_id) REFERENCES study(id);
2858
2859
2860--
2861-- Name: fk93f4a8a46f1f15b4; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2862--
2863
2864ALTER TABLE ONLY study_event
2865    ADD CONSTRAINT fk93f4a8a46f1f15b4 FOREIGN KEY (event_id) REFERENCES event(id);
2866
2867
2868--
2869-- Name: fk9a278becc4f3e44; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2870--
2871
2872ALTER TABLE ONLY clinical_string_data
2873    ADD CONSTRAINT fk9a278becc4f3e44 FOREIGN KEY (measurement_id) REFERENCES feature_base(id);
2874
2875
2876--
2877-- Name: fk9b9ab287a98e8df4; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2878--
2879
2880ALTER TABLE ONLY event_group_subject
2881    ADD CONSTRAINT fk9b9ab287a98e8df4 FOREIGN KEY (subject_id) REFERENCES subject(id);
2882
2883
2884--
2885-- Name: fk9b9ab287d7e06579; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2886--
2887
2888ALTER TABLE ONLY event_group_subject
2889    ADD CONSTRAINT fk9b9ab287d7e06579 FOREIGN KEY (event_group_subjects_id) REFERENCES event_group(id);
2890
2891
2892--
2893-- Name: fka305a0d7239fd3b8; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2894--
2895
2896ALTER TABLE ONLY profile_base_url
2897    ADD CONSTRAINT fka305a0d7239fd3b8 FOREIGN KEY (url_id) REFERENCES url(id);
2898
2899
2900--
2901-- Name: fka305a0d7e0ef9d62; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2902--
2903
2904ALTER TABLE ONLY profile_base_url
2905    ADD CONSTRAINT fka305a0d7e0ef9d62 FOREIGN KEY (profile_base_websites_id) REFERENCES profile_base(id);
2906
2907
2908--
2909-- Name: fka4c16028bb02cc73; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2910--
2911
2912ALTER TABLE ONLY _user_passwd_history
2913    ADD CONSTRAINT fka4c16028bb02cc73 FOREIGN KEY (user_base_id) REFERENCES _user(id);
2914
2915
2916--
2917-- Name: fka708413a1953ed7f; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2918--
2919
2920ALTER TABLE ONLY event_template_field
2921    ADD CONSTRAINT fka708413a1953ed7f FOREIGN KEY (template_field_id) REFERENCES template_field(id);
2922
2923
2924--
2925-- Name: fka708413abb6d962a; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2926--
2927
2928ALTER TABLE ONLY event_template_field
2929    ADD CONSTRAINT fka708413abb6d962a FOREIGN KEY (event_system_fields_id) REFERENCES event(id);
2930
2931
2932--
2933-- Name: fka9e4a00833e6dfd8; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2934--
2935
2936ALTER TABLE ONLY social_media_service
2937    ADD CONSTRAINT fka9e4a00833e6dfd8 FOREIGN KEY (details_id) REFERENCES details(id);
2938
2939
2940--
2941-- Name: fka9e4a008fa33923c; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2942--
2943
2944ALTER TABLE ONLY social_media_service
2945    ADD CONSTRAINT fka9e4a008fa33923c FOREIGN KEY (base_profile_url_id) REFERENCES url(id);
2946
2947
2948--
2949-- Name: fkadd6169eac8a955c; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2950--
2951
2952ALTER TABLE ONLY _role_users
2953    ADD CONSTRAINT fkadd6169eac8a955c FOREIGN KEY (role_id) REFERENCES _role(id);
2954
2955
2956--
2957-- Name: fkadd6169ebb02cc73; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2958--
2959
2960ALTER TABLE ONLY _role_users
2961    ADD CONSTRAINT fkadd6169ebb02cc73 FOREIGN KEY (user_base_id) REFERENCES _user(id);
2962
2963
2964--
2965-- Name: fkb31804d568dd785d; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2966--
2967
2968ALTER TABLE ONLY _user__user
2969    ADD CONSTRAINT fkb31804d568dd785d FOREIGN KEY (user_base_followers_id) REFERENCES _user(id);
2970
2971
2972--
2973-- Name: fkb31804d5bb02cc73; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2974--
2975
2976ALTER TABLE ONLY _user__user
2977    ADD CONSTRAINT fkb31804d5bb02cc73 FOREIGN KEY (user_base_id) REFERENCES _user(id);
2978
2979
2980--
2981-- Name: fkb31804d5d3d018f0; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2982--
2983
2984ALTER TABLE ONLY _user__user
2985    ADD CONSTRAINT fkb31804d5d3d018f0 FOREIGN KEY (user_base_follows_id) REFERENCES _user(id);
2986
2987
2988--
2989-- Name: fkbb979bf4b83749f; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2990--
2991
2992ALTER TABLE ONLY address
2993    ADD CONSTRAINT fkbb979bf4b83749f FOREIGN KEY (owner_id) REFERENCES profile_base(id);
2994
2995
2996--
2997-- Name: fkbda777362046a45c; Type: FK CONSTRAINT; Schema: public; Owner: gscf
2998--
2999
3000ALTER TABLE ONLY profile_base_feed
3001    ADD CONSTRAINT fkbda777362046a45c FOREIGN KEY (feed_id) REFERENCES feed(id);
3002
3003
3004--
3005-- Name: fkbda77736caa47b15; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3006--
3007
3008ALTER TABLE ONLY profile_base_feed
3009    ADD CONSTRAINT fkbda77736caa47b15 FOREIGN KEY (profile_base_feeds_id) REFERENCES profile_base(id);
3010
3011
3012--
3013-- Name: fkc3b4e354369e19fb; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3014--
3015
3016ALTER TABLE ONLY template_field_template_field_list_item
3017    ADD CONSTRAINT fkc3b4e354369e19fb FOREIGN KEY (template_field_list_item_id) REFERENCES template_field_list_item(id);
3018
3019
3020--
3021-- Name: fkc3edd55239f59329; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3022--
3023
3024ALTER TABLE ONLY import_mapping_mapping_column
3025    ADD CONSTRAINT fkc3edd55239f59329 FOREIGN KEY (mapping_column_id) REFERENCES mapping_column(id);
3026
3027
3028--
3029-- Name: fkc3edd552aec07603; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3030--
3031
3032ALTER TABLE ONLY import_mapping_mapping_column
3033    ADD CONSTRAINT fkc3edd552aec07603 FOREIGN KEY (import_mapping_columns_id) REFERENCES import_mapping(id);
3034
3035
3036--
3037-- Name: fkc93cb6a2cab6b3e1; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3038--
3039
3040ALTER TABLE ONLY level_permission_fifth
3041    ADD CONSTRAINT fkc93cb6a2cab6b3e1 FOREIGN KEY (level_permission_id) REFERENCES permission(id);
3042
3043
3044--
3045-- Name: fkc93ce39bcab6b3e1; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3046--
3047
3048ALTER TABLE ONLY level_permission_first
3049    ADD CONSTRAINT fkc93ce39bcab6b3e1 FOREIGN KEY (level_permission_id) REFERENCES permission(id);
3050
3051
3052--
3053-- Name: fkc9c775aa27db9c02; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3054--
3055
3056ALTER TABLE ONLY sample
3057    ADD CONSTRAINT fkc9c775aa27db9c02 FOREIGN KEY (parent_event_id) REFERENCES sampling_event(id);
3058
3059
3060--
3061-- Name: fkc9c775aa2f40b9d5; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3062--
3063
3064ALTER TABLE ONLY sample
3065    ADD CONSTRAINT fkc9c775aa2f40b9d5 FOREIGN KEY (material_id) REFERENCES term(id);
3066
3067
3068--
3069-- Name: fkc9c775aa4247a300; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3070--
3071
3072ALTER TABLE ONLY sample
3073    ADD CONSTRAINT fkc9c775aa4247a300 FOREIGN KEY (template_id) REFERENCES "template"(id);
3074
3075
3076--
3077-- Name: fkc9c775aac604aca9; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3078--
3079
3080ALTER TABLE ONLY sample
3081    ADD CONSTRAINT fkc9c775aac604aca9 FOREIGN KEY (parent_subject_id) REFERENCES subject(id);
3082
3083
3084--
3085-- Name: fkc9f42bc1cab6b3e1; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3086--
3087
3088ALTER TABLE ONLY level_permission_sixth
3089    ADD CONSTRAINT fkc9f42bc1cab6b3e1 FOREIGN KEY (level_permission_id) REFERENCES permission(id);
3090
3091
3092--
3093-- Name: fkca019652cab6b3e1; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3094--
3095
3096ALTER TABLE ONLY level_permission_third
3097    ADD CONSTRAINT fkca019652cab6b3e1 FOREIGN KEY (level_permission_id) REFERENCES permission(id);
3098
3099
3100--
3101-- Name: fkcacdcff2239fd3b8; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3102--
3103
3104ALTER TABLE ONLY status
3105    ADD CONSTRAINT fkcacdcff2239fd3b8 FOREIGN KEY (url_id) REFERENCES url(id);
3106
3107
3108--
3109-- Name: fkcacdcff2b83749f; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3110--
3111
3112ALTER TABLE ONLY status
3113    ADD CONSTRAINT fkcacdcff2b83749f FOREIGN KEY (owner_id) REFERENCES profile_base(id);
3114
3115
3116--
3117-- Name: fkcc0c1247b5fe38a4; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3118--
3119
3120ALTER TABLE ONLY clinical_assay_instance
3121    ADD CONSTRAINT fkcc0c1247b5fe38a4 FOREIGN KEY (assay_id) REFERENCES clinical_assay(id);
3122
3123
3124--
3125-- Name: fkdc46c9ab999ed6d1; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3126--
3127
3128ALTER TABLE ONLY compound
3129    ADD CONSTRAINT fkdc46c9ab999ed6d1 FOREIGN KEY (compound_id) REFERENCES term(id);
3130
3131
3132--
3133-- Name: fke125c5cf123bda38; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3134--
3135
3136ALTER TABLE ONLY permission
3137    ADD CONSTRAINT fke125c5cf123bda38 FOREIGN KEY (group_id) REFERENCES _group(id);
3138
3139
3140--
3141-- Name: fke125c5cf6b2175ad; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3142--
3143
3144ALTER TABLE ONLY permission
3145    ADD CONSTRAINT fke125c5cf6b2175ad FOREIGN KEY (user_id) REFERENCES _user(id);
3146
3147
3148--
3149-- Name: fke125c5cfac8a955c; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3150--
3151
3152ALTER TABLE ONLY permission
3153    ADD CONSTRAINT fke125c5cfac8a955c FOREIGN KEY (role_id) REFERENCES _role(id);
3154
3155
3156--
3157-- Name: fked74638013c6ed3e; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3158--
3159
3160ALTER TABLE ONLY social_media_account
3161    ADD CONSTRAINT fked74638013c6ed3e FOREIGN KEY (profile_id) REFERENCES url(id);
3162
3163
3164--
3165-- Name: fked746380950ad505; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3166--
3167
3168ALTER TABLE ONLY social_media_account
3169    ADD CONSTRAINT fked746380950ad505 FOREIGN KEY (service_id) REFERENCES social_media_service(id);
3170
3171
3172--
3173-- Name: fked746380b83749f; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3174--
3175
3176ALTER TABLE ONLY social_media_account
3177    ADD CONSTRAINT fked746380b83749f FOREIGN KEY (owner_id) REFERENCES profile_base(id);
3178
3179
3180--
3181-- Name: fkef124b114368590; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3182--
3183
3184ALTER TABLE ONLY feature_base_term
3185    ADD CONSTRAINT fkef124b114368590 FOREIGN KEY (feature_base_organism_part_id) REFERENCES feature_base(id);
3186
3187
3188--
3189-- Name: fkef124b114ec66994; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3190--
3191
3192ALTER TABLE ONLY feature_base_term
3193    ADD CONSTRAINT fkef124b114ec66994 FOREIGN KEY (feature_base_disease_id) REFERENCES feature_base(id);
3194
3195
3196--
3197-- Name: fkef124b11731cd870; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3198--
3199
3200ALTER TABLE ONLY feature_base_term
3201    ADD CONSTRAINT fkef124b11731cd870 FOREIGN KEY (term_id) REFERENCES term(id);
3202
3203
3204--
3205-- Name: fkef124b1182c4dce6; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3206--
3207
3208ALTER TABLE ONLY feature_base_term
3209    ADD CONSTRAINT fkef124b1182c4dce6 FOREIGN KEY (feature_base_enzyme_id) REFERENCES feature_base(id);
3210
3211
3212--
3213-- Name: fkef124b11b004c3e6; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3214--
3215
3216ALTER TABLE ONLY feature_base_term
3217    ADD CONSTRAINT fkef124b11b004c3e6 FOREIGN KEY (feature_base_metabolite_id) REFERENCES feature_base(id);
3218
3219
3220--
3221-- Name: fkef124b11cf1c4d46; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3222--
3223
3224ALTER TABLE ONLY feature_base_term
3225    ADD CONSTRAINT fkef124b11cf1c4d46 FOREIGN KEY (feature_base_drug_id) REFERENCES feature_base(id);
3226
3227
3228--
3229-- Name: fkef124b11f3d55ddb; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3230--
3231
3232ALTER TABLE ONLY feature_base_term
3233    ADD CONSTRAINT fkef124b11f3d55ddb FOREIGN KEY (feature_base_compound_id) REFERENCES feature_base(id);
3234
3235
3236--
3237-- Name: fkf43101e7d70825c5; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3238--
3239
3240ALTER TABLE ONLY login_record
3241    ADD CONSTRAINT fkf43101e7d70825c5 FOREIGN KEY (owner_id) REFERENCES _user(id);
3242
3243
3244--
3245-- Name: fkf9ebc2a1953ed7f; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3246--
3247
3248ALTER TABLE ONLY sample_template_field
3249    ADD CONSTRAINT fkf9ebc2a1953ed7f FOREIGN KEY (template_field_id) REFERENCES template_field(id);
3250
3251
3252--
3253-- Name: fkf9ebc2a83649af6; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3254--
3255
3256ALTER TABLE ONLY sample_template_field
3257    ADD CONSTRAINT fkf9ebc2a83649af6 FOREIGN KEY (sample_system_fields_id) REFERENCES sample(id);
3258
3259
3260--
3261-- Name: fkfc7c268b675e4f5; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3262--
3263
3264ALTER TABLE ONLY study_person
3265    ADD CONSTRAINT fkfc7c268b675e4f5 FOREIGN KEY (role_id) REFERENCES person_role(id);
3266
3267
3268--
3269-- Name: fkfc7c268bb7959aa0; Type: FK CONSTRAINT; Schema: public; Owner: gscf
3270--
3271
3272ALTER TABLE ONLY study_person
3273    ADD CONSTRAINT fkfc7c268bb7959aa0 FOREIGN KEY (person_id) REFERENCES person(id);
3274
3275
3276--
3277-- Name: public; Type: ACL; Schema: -; Owner: postgres
3278--
3279
3280REVOKE ALL ON SCHEMA public FROM PUBLIC;
3281REVOKE ALL ON SCHEMA public FROM postgres;
3282GRANT ALL ON SCHEMA public TO postgres;
3283GRANT ALL ON SCHEMA public TO PUBLIC;
3284
3285
3286--
3287-- PostgreSQL database dump complete
3288--
3289
Note: See TracBrowser for help on using the repository browser.