Project

General

Profile

1
--
2
-- PostgreSQL database dump
3
--
4

    
5

    
6

    
7

    
8

    
9

    
10

    
11

    
12

    
13

    
14
--
15
-- Name: establishmentmeans_dwc; Type: TYPE; Schema: public; Owner: -
16
--
17

    
18

    
19

    
20

    
21
--
22
-- Name: TYPE establishmentmeans_dwc; Type: COMMENT; Schema: public; Owner: -
23
--
24

    
25

    
26

    
27

    
28
--
29
-- Name: growthform; Type: TYPE; Schema: public; Owner: -
30
--
31

    
32

    
33

    
34

    
35
--
36
-- Name: occurrencestatus_dwc; Type: TYPE; Schema: public; Owner: -
37
--
38

    
39

    
40

    
41

    
42
--
43
-- Name: placerank; Type: TYPE; Schema: public; Owner: -
44
--
45

    
46

    
47

    
48

    
49
--
50
-- Name: TYPE placerank; Type: COMMENT; Schema: public; Owner: -
51
--
52

    
53

    
54

    
55

    
56
--
57
-- Name: rankedplacename; Type: TYPE; Schema: public; Owner: -
58
--
59

    
60

    
61

    
62

    
63
--
64
-- Name: taxonrank; Type: TYPE; Schema: public; Owner: -
65
--
66

    
67

    
68

    
69

    
70
--
71
-- Name: TYPE taxonrank; Type: COMMENT; Schema: public; Owner: -
72
--
73

    
74

    
75

    
76

    
77
--
78
-- Name: rankedtaxonname; Type: TYPE; Schema: public; Owner: -
79
--
80

    
81

    
82

    
83

    
84
--
85
-- Name: role; Type: TYPE; Schema: public; Owner: -
86
--
87

    
88

    
89

    
90

    
91
--
92
-- Name: taxonclass; Type: TYPE; Schema: public; Owner: -
93
--
94

    
95

    
96

    
97

    
98
--
99
-- Name: TYPE taxonclass; Type: COMMENT; Schema: public; Owner: -
100
--
101

    
102

    
103

    
104

    
105
--
106
-- Name: make_analytical_db(); Type: FUNCTION; Schema: public; Owner: -
107
--
108

    
109

    
110

    
111

    
112
--
113
-- Name: place_update_ancestors(); Type: FUNCTION; Schema: public; Owner: -
114
--
115

    
116

    
117

    
118

    
119
--
120
-- Name: plantobservation_aggregateoccurrence_count_1(); Type: FUNCTION; Schema: public; Owner: -
121
--
122

    
123

    
124

    
125

    
126
--
127
-- Name: taxon_update_ancestors(); Type: FUNCTION; Schema: public; Owner: -
128
--
129

    
130

    
131

    
132

    
133
--
134
-- Name: concat(text); Type: AGGREGATE; Schema: public; Owner: -
135
--
136

    
137

    
138

    
139

    
140

    
141

    
142

    
143

    
144
--
145
-- Name: address; Type: TABLE; Schema: public; Owner: -; Tablespace: 
146
--
147

    
148
CREATE TABLE address (
149
    address_id int(11) NOT NULL,
150
    party_id int(11) NOT NULL,
151
    organization_id int(11),
152
    orgposition text,
153
    email text,
154
    deliverypoint text,
155
    city text,
156
    administrativearea text,
157
    postalcode text,
158
    country text,
159
    currentflag int(1),
160
    addressstartdate timestamp NULL
161
);
162

    
163

    
164
--
165
-- Name: address_address_id_seq; Type: SEQUENCE; Schema: public; Owner: -
166
--
167

    
168

    
169

    
170

    
171
--
172
-- Name: address_address_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
173
--
174

    
175

    
176

    
177

    
178
--
179
-- Name: aggregateoccurrence; Type: TABLE; Schema: public; Owner: -; Tablespace: 
180
--
181

    
182
CREATE TABLE aggregateoccurrence (
183
    aggregateoccurrence_id int(11) NOT NULL,
184
    datasource_id int(11) NOT NULL,
185
    sourceaccessioncode text,
186
    taxonoccurrence_id int(11) NOT NULL,
187
    collectiondate timestamp NULL,
188
    cover_fraction double precision,
189
    linecover_m double precision,
190
    basalarea_m2 double precision,
191
    biomass_kg_m2 double precision,
192
    inferencearea_m2 double precision,
193
    count int(11),
194
    stratum_id int(11),
195
    coverindex_id int(11),
196
    occurrencestatus_dwc text DEFAULT 'present' NOT NULL,
197
    method_id int(11),
198
    notes text,
199
    accessioncode text
200
);
201

    
202

    
203
--
204
-- Name: TABLE aggregateoccurrence; Type: COMMENT; Schema: public; Owner: -
205
--
206

    
207

    
208

    
209

    
210
--
211
-- Name: COLUMN aggregateoccurrence.linecover_m; Type: COMMENT; Schema: public; Owner: -
212
--
213

    
214

    
215

    
216

    
217
--
218
-- Name: COLUMN aggregateoccurrence.occurrencestatus_dwc; Type: COMMENT; Schema: public; Owner: -
219
--
220

    
221

    
222

    
223

    
224
--
225
-- Name: aggregateoccurrence_aggregateoccurrence_id_seq; Type: SEQUENCE; Schema: public; Owner: -
226
--
227

    
228

    
229

    
230

    
231
--
232
-- Name: aggregateoccurrence_aggregateoccurrence_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
233
--
234

    
235

    
236

    
237

    
238
--
239
-- Name: location; Type: TABLE; Schema: public; Owner: -; Tablespace: 
240
--
241

    
242
CREATE TABLE location (
243
    location_id int(11) NOT NULL,
244
    datasource_id int(11) NOT NULL,
245
    sourceaccessioncode text,
246
    parent_id int(11),
247
    authorlocationcode text,
248
    confidentialitystatus int(11) DEFAULT 0 NOT NULL,
249
    confidentialityreason text,
250
    sublocationxposition_m double precision,
251
    sublocationyposition_m double precision,
252
    authorzone text,
253
    authordatum text,
254
    authorlocation text,
255
    locationnarrative text,
256
    azimuth double precision,
257
    shape text,
258
    area_m2 double precision,
259
    standsize text,
260
    placementmethod text,
261
    permanence int(1),
262
    layoutnarrative text,
263
    elevation_m double precision,
264
    elevationaccuracy_m double precision,
265
    elevationrange_m double precision,
266
    verbatimelevation text,
267
    slopeaspect_deg double precision,
268
    minslopeaspect_deg double precision,
269
    maxslopeaspect_deg double precision,
270
    slopegradient_fraction double precision,
271
    minslopegradient_fraction double precision,
272
    maxslopegradient_fraction double precision,
273
    topoposition text,
274
    landform text,
275
    surficialdeposits text,
276
    rocktype text,
277
    submitter_surname text,
278
    submitter_givenname text,
279
    submitter_email text,
280
    notespublic int(1),
281
    notesmgt int(1),
282
    revisions int(1),
283
    dateentered timestamp NULL ,
284
    locationrationalenarrative text,
285
    accessioncode text
286
);
287

    
288

    
289
--
290
-- Name: TABLE location; Type: COMMENT; Schema: public; Owner: -
291
--
292

    
293

    
294

    
295

    
296
--
297
-- Name: locationcoords; Type: TABLE; Schema: public; Owner: -; Tablespace: 
298
--
299

    
300
CREATE TABLE locationcoords (
301
    locationcoords_id int(11) NOT NULL,
302
    location_id int(11) NOT NULL,
303
    latitude_deg double precision,
304
    longitude_deg double precision,
305
    verbatimlatitude text,
306
    verbatimlongitude text,
307
    verbatimcoordinates text,
308
    footprintgeometry_dwc text,
309
    coordsaccuracy_deg double precision,
310
    identifier_id int(11),
311
    determinationdate timestamp NULL,
312
    isoriginal int(1) DEFAULT false NOT NULL,
313
    iscurrent int(1) DEFAULT false NOT NULL,
314
    calculated int(1)
315
);
316

    
317

    
318
--
319
-- Name: COLUMN locationcoords.footprintgeometry_dwc; Type: COMMENT; Schema: public; Owner: -
320
--
321

    
322

    
323

    
324

    
325
--
326
-- Name: COLUMN locationcoords.coordsaccuracy_deg; Type: COMMENT; Schema: public; Owner: -
327
--
328

    
329

    
330

    
331

    
332
--
333
-- Name: locationevent; Type: TABLE; Schema: public; Owner: -; Tablespace: 
334
--
335

    
336
CREATE TABLE locationevent (
337
    locationevent_id int(11) NOT NULL,
338
    datasource_id int(11) NOT NULL,
339
    sourceaccessioncode text,
340
    parent_id int(11),
341
    location_id int(11),
342
    project_id int(11),
343
    authoreventcode text,
344
    previous_id int(11),
345
    dateaccuracy text,
346
    method_id int(11),
347
    temperature_c double precision,
348
    precipitation_m double precision,
349
    autotaxoncover int(1),
350
    originaldata text,
351
    effortlevel text,
352
    floristicquality text,
353
    bryophytequality text,
354
    lichenquality text,
355
    locationeventnarrative text,
356
    landscapenarrative text,
357
    homogeneity text,
358
    phenologicaspect text,
359
    representativeness text,
360
    standmaturity text,
361
    successionalstatus text,
362
    basalarea double precision,
363
    hydrologicregime text,
364
    soilmoistureregime text,
365
    soildrainage text,
366
    watersalinity text,
367
    waterdepth_m double precision,
368
    shoredistance double precision,
369
    soildepth double precision,
370
    organicdepth double precision,
371
    soiltaxon_id int(11),
372
    soiltaxonsrc text,
373
    percentbedrock double precision,
374
    percentrockgravel double precision,
375
    percentwood double precision,
376
    percentlitter double precision,
377
    percentbaresoil double precision,
378
    percentwater double precision,
379
    percentother double precision,
380
    nameother text,
381
    treeht double precision,
382
    shrubht double precision,
383
    fieldht double precision,
384
    nonvascularht double precision,
385
    submergedht double precision,
386
    treecover double precision,
387
    shrubcover double precision,
388
    fieldcover double precision,
389
    nonvascularcover double precision,
390
    floatingcover double precision,
391
    submergedcover double precision,
392
    dominantstratum text,
393
    growthform1type text,
394
    growthform2type text,
395
    growthform3type text,
396
    growthform1cover double precision,
397
    growthform2cover double precision,
398
    growthform3cover double precision,
399
    totalcover double precision,
400
    notespublic int(1),
401
    notesmgt int(1),
402
    revisions int(1),
403
    obsstartdate timestamp NULL,
404
    obsenddate timestamp NULL,
405
    dateentered timestamp NULL ,
406
    toptaxon1name text,
407
    toptaxon2name text,
408
    toptaxon3name text,
409
    toptaxon4name text,
410
    toptaxon5name text,
411
    numberoftaxa int(11),
412
    accessioncode text
413
);
414

    
415

    
416
--
417
-- Name: TABLE locationevent; Type: COMMENT; Schema: public; Owner: -
418
--
419

    
420

    
421

    
422

    
423
--
424
-- Name: locationplace; Type: TABLE; Schema: public; Owner: -; Tablespace: 
425
--
426

    
427
CREATE TABLE locationplace (
428
    locationplace_id int(11) NOT NULL,
429
    location_id int(11) NOT NULL,
430
    placepath_id int(11) NOT NULL,
431
    identifier_id int(11)
432
);
433

    
434

    
435
--
436
-- Name: TABLE locationplace; Type: COMMENT; Schema: public; Owner: -
437
--
438

    
439

    
440

    
441

    
442
--
443
-- Name: method; Type: TABLE; Schema: public; Owner: -; Tablespace: 
444
--
445

    
446
CREATE TABLE method (
447
    method_id int(11) NOT NULL,
448
    reference_id int(11),
449
    name text NOT NULL,
450
    description text,
451
    diameterheight_m double precision,
452
    mindiameter_m double precision,
453
    maxdiameter_m double precision,
454
    minheight_m double precision,
455
    maxheight_m double precision,
456
    observationtype text,
457
    observationmeasure text,
458
    covermethod_id int(11),
459
    samplingfactor double precision DEFAULT 1 NOT NULL,
460
    coverbasis text,
461
    stemsamplemethod text,
462
    shape text,
463
    length_m double precision,
464
    width_m double precision,
465
    radius_m double precision,
466
    area_m2 double precision,
467
    samplearea_m2 double precision,
468
    subplotspacing_m double precision,
469
    subplotmethod_id int(11),
470
    pointsperline int(11),
471
    accessioncode text
472
);
473

    
474

    
475
--
476
-- Name: TABLE method; Type: COMMENT; Schema: public; Owner: -
477
--
478

    
479

    
480

    
481

    
482
--
483
-- Name: COLUMN method.reference_id; Type: COMMENT; Schema: public; Owner: -
484
--
485

    
486

    
487

    
488

    
489
--
490
-- Name: COLUMN method.name; Type: COMMENT; Schema: public; Owner: -
491
--
492

    
493

    
494

    
495

    
496
--
497
-- Name: COLUMN method.description; Type: COMMENT; Schema: public; Owner: -
498
--
499

    
500

    
501

    
502

    
503
--
504
-- Name: COLUMN method.diameterheight_m; Type: COMMENT; Schema: public; Owner: -
505
--
506

    
507

    
508

    
509

    
510
--
511
-- Name: COLUMN method.mindiameter_m; Type: COMMENT; Schema: public; Owner: -
512
--
513

    
514

    
515

    
516

    
517
--
518
-- Name: COLUMN method.maxdiameter_m; Type: COMMENT; Schema: public; Owner: -
519
--
520

    
521

    
522

    
523

    
524
--
525
-- Name: COLUMN method.minheight_m; Type: COMMENT; Schema: public; Owner: -
526
--
527

    
528

    
529

    
530

    
531
--
532
-- Name: COLUMN method.maxheight_m; Type: COMMENT; Schema: public; Owner: -
533
--
534

    
535

    
536

    
537

    
538
--
539
-- Name: COLUMN method.observationtype; Type: COMMENT; Schema: public; Owner: -
540
--
541

    
542

    
543

    
544

    
545
--
546
-- Name: COLUMN method.observationmeasure; Type: COMMENT; Schema: public; Owner: -
547
--
548

    
549

    
550

    
551

    
552
--
553
-- Name: COLUMN method.samplingfactor; Type: COMMENT; Schema: public; Owner: -
554
--
555

    
556

    
557

    
558

    
559
--
560
-- Name: COLUMN method.coverbasis; Type: COMMENT; Schema: public; Owner: -
561
--
562

    
563

    
564

    
565

    
566
--
567
-- Name: COLUMN method.stemsamplemethod; Type: COMMENT; Schema: public; Owner: -
568
--
569

    
570

    
571

    
572

    
573
--
574
-- Name: COLUMN method.shape; Type: COMMENT; Schema: public; Owner: -
575
--
576

    
577

    
578

    
579

    
580
--
581
-- Name: COLUMN method.length_m; Type: COMMENT; Schema: public; Owner: -
582
--
583

    
584

    
585

    
586

    
587
--
588
-- Name: COLUMN method.width_m; Type: COMMENT; Schema: public; Owner: -
589
--
590

    
591

    
592

    
593

    
594
--
595
-- Name: COLUMN method.radius_m; Type: COMMENT; Schema: public; Owner: -
596
--
597

    
598

    
599

    
600

    
601
--
602
-- Name: COLUMN method.area_m2; Type: COMMENT; Schema: public; Owner: -
603
--
604

    
605

    
606

    
607

    
608
--
609
-- Name: COLUMN method.samplearea_m2; Type: COMMENT; Schema: public; Owner: -
610
--
611

    
612

    
613

    
614

    
615
--
616
-- Name: COLUMN method.subplotspacing_m; Type: COMMENT; Schema: public; Owner: -
617
--
618

    
619

    
620

    
621

    
622
--
623
-- Name: COLUMN method.subplotmethod_id; Type: COMMENT; Schema: public; Owner: -
624
--
625

    
626

    
627

    
628

    
629
--
630
-- Name: COLUMN method.pointsperline; Type: COMMENT; Schema: public; Owner: -
631
--
632

    
633

    
634

    
635

    
636
--
637
-- Name: party; Type: TABLE; Schema: public; Owner: -; Tablespace: 
638
--
639

    
640
CREATE TABLE party (
641
    party_id int(11) NOT NULL,
642
    salutation text,
643
    givenname text,
644
    middlename text,
645
    surname text,
646
    organizationname text,
647
    currentname_id int(11),
648
    contactinstructions text,
649
    email text,
650
    partytype text,
651
    partypublic int(1) DEFAULT true,
652
    d_obscount int(11),
653
    accessioncode text
654
);
655

    
656

    
657
--
658
-- Name: placepath; Type: TABLE; Schema: public; Owner: -; Tablespace: 
659
--
660

    
661
CREATE TABLE placepath (
662
    placepath_id int(11) NOT NULL,
663
    datasource_id int(11) NOT NULL,
664
    placecode text,
665
    place_id int(11),
666
    continent text,
667
    country text,
668
    stateprovince text,
669
    county text,
670
    municipality text,
671
    site text,
672
    otherranks text
673
);
674

    
675

    
676
--
677
-- Name: TABLE placepath; Type: COMMENT; Schema: public; Owner: -
678
--
679

    
680

    
681

    
682

    
683
--
684
-- Name: COLUMN placepath.otherranks; Type: COMMENT; Schema: public; Owner: -
685
--
686

    
687

    
688

    
689

    
690
--
691
-- Name: plantobservation; Type: TABLE; Schema: public; Owner: -; Tablespace: 
692
--
693

    
694
CREATE TABLE plantobservation (
695
    plantobservation_id int(11) NOT NULL,
696
    datasource_id int(11) NOT NULL,
697
    sourceaccessioncode text,
698
    aggregateoccurrence_id int(11) NOT NULL,
699
    overallheight_m double precision,
700
    overallheightaccuracy_m double precision,
701
    collectionnumber text,
702
    stemcount int(11),
703
    plant_id int(11),
704
    accessioncode text
705
);
706

    
707

    
708
--
709
-- Name: TABLE plantobservation; Type: COMMENT; Schema: public; Owner: -
710
--
711

    
712

    
713

    
714

    
715
--
716
-- Name: COLUMN plantobservation.collectionnumber; Type: COMMENT; Schema: public; Owner: -
717
--
718

    
719

    
720

    
721

    
722
--
723
-- Name: specimenreplicate; Type: TABLE; Schema: public; Owner: -; Tablespace: 
724
--
725

    
726
CREATE TABLE specimenreplicate (
727
    specimenreplicate_id int(11) NOT NULL,
728
    datasource_id int(11) NOT NULL,
729
    sourceaccessioncode text,
730
    plantobservation_id int(11),
731
    institution_id int(11),
732
    collectioncode_dwc text,
733
    catalognumber_dwc text,
734
    description text,
735
    specimen_id int(11),
736
    accessioncode text
737
);
738

    
739

    
740
--
741
-- Name: TABLE specimenreplicate; Type: COMMENT; Schema: public; Owner: -
742
--
743

    
744

    
745

    
746

    
747
--
748
-- Name: COLUMN specimenreplicate.institution_id; Type: COMMENT; Schema: public; Owner: -
749
--
750

    
751

    
752

    
753

    
754
--
755
-- Name: COLUMN specimenreplicate.collectioncode_dwc; Type: COMMENT; Schema: public; Owner: -
756
--
757

    
758

    
759

    
760

    
761
--
762
-- Name: taxondetermination; Type: TABLE; Schema: public; Owner: -; Tablespace: 
763
--
764

    
765
CREATE TABLE taxondetermination (
766
    taxondetermination_id int(11) NOT NULL,
767
    taxonoccurrence_id int(11) NOT NULL,
768
    taxonpath_id int(11) NOT NULL,
769
    party_id int(11),
770
    role text DEFAULT 'unknown' NOT NULL,
771
    determinationtype text,
772
    reference_id int(11),
773
    isoriginal int(1) DEFAULT false NOT NULL,
774
    iscurrent int(1) DEFAULT false NOT NULL,
775
    taxonfit text,
776
    taxonconfidence text,
777
    grouptype text,
778
    notes text,
779
    notespublic int(1),
780
    notesmgt int(1),
781
    revisions int(1),
782
    determinationdate timestamp NULL,
783
    accessioncode text
784
);
785

    
786

    
787
--
788
-- Name: TABLE taxondetermination; Type: COMMENT; Schema: public; Owner: -
789
--
790

    
791

    
792

    
793

    
794
--
795
-- Name: taxonoccurrence; Type: TABLE; Schema: public; Owner: -; Tablespace: 
796
--
797

    
798
CREATE TABLE taxonoccurrence (
799
    taxonoccurrence_id int(11) NOT NULL,
800
    datasource_id int(11) NOT NULL,
801
    sourceaccessioncode text,
802
    locationevent_id int(11),
803
    authortaxoncode text,
804
    verbatimcollectorname text,
805
    growthform text,
806
    iscultivated int(1),
807
    cultivatedbasis text,
808
    isnative int(1),
809
    accessioncode text
810
);
811

    
812

    
813
--
814
-- Name: TABLE taxonoccurrence; Type: COMMENT; Schema: public; Owner: -
815
--
816

    
817

    
818

    
819

    
820
--
821
-- Name: COLUMN taxonoccurrence.iscultivated; Type: COMMENT; Schema: public; Owner: -
822
--
823

    
824

    
825

    
826

    
827
--
828
-- Name: COLUMN taxonoccurrence.cultivatedbasis; Type: COMMENT; Schema: public; Owner: -
829
--
830

    
831

    
832

    
833

    
834
--
835
-- Name: COLUMN taxonoccurrence.isnative; Type: COMMENT; Schema: public; Owner: -
836
--
837

    
838

    
839

    
840

    
841
--
842
-- Name: taxonpath; Type: TABLE; Schema: public; Owner: -; Tablespace: 
843
--
844

    
845
CREATE TABLE taxonpath (
846
    taxonpath_id int(11) NOT NULL,
847
    datasource_id int(11) NOT NULL,
848
    plantcode text,
849
    canon_taxonpath_id int(11),
850
    taxon_id int(11),
851
    scientificname text,
852
    author text,
853
    scientificnamewithauthor text,
854
    domain text,
855
    kingdom text,
856
    phylum text,
857
    class text,
858
    `order` text,
859
    family text,
860
    genus text,
861
    species text,
862
    subspecies text,
863
    variety text,
864
    forma text,
865
    cultivar text,
866
    otherranks text,
867
    scope_id int(11),
868
    accessioncode text
869
);
870

    
871

    
872
--
873
-- Name: TABLE taxonpath; Type: COMMENT; Schema: public; Owner: -
874
--
875

    
876

    
877

    
878

    
879
--
880
-- Name: COLUMN taxonpath.author; Type: COMMENT; Schema: public; Owner: -
881
--
882

    
883

    
884

    
885

    
886
--
887
-- Name: COLUMN taxonpath.scientificnamewithauthor; Type: COMMENT; Schema: public; Owner: -
888
--
889

    
890

    
891

    
892

    
893
--
894
-- Name: COLUMN taxonpath.otherranks; Type: COMMENT; Schema: public; Owner: -
895
--
896

    
897

    
898

    
899

    
900
--
901
-- Name: COLUMN taxonpath.scope_id; Type: COMMENT; Schema: public; Owner: -
902
--
903

    
904

    
905

    
906

    
907
--
908
-- Name: analytical_db_view; Type: VIEW; Schema: public; Owner: -
909
--
910

    
911
CREATE VIEW analytical_db_view AS
912
    SELECT datasource.organizationname AS `dataSourceName`, taxonpath.family, taxonpath.genus, taxonpath.species, COALESCE(taxonpath.scientificnamewithauthor, taxonpath.scientificname) AS taxon, taxonpath.author AS `taxonAuthor`, taxonpath.variety AS `taxonMorphospecies`, placepath.country, placepath.stateprovince AS `stateProvince`, placepath.county AS `countyParish`, taxonoccurrence.verbatimcollectorname AS collector, plantobservation.collectionnumber AS `collectionNumber`, array_to_string(ARRAY[identifiedby.givenname, identifiedby.middlename, identifiedby.surname], CAST(' ' AS text)) AS `identifiedBy`, aggregateoccurrence.collectiondate AS `observationDate`, location.authorlocationcode AS `plotCode`, functions._m2_to_ha(location.area_m2) AS `plotAreaHa`, method.name AS `plotMethod`, locationcoords.latitude_deg AS latitude, locationcoords.longitude_deg AS longitude, location.elevation_m, taxonoccurrence.iscultivated AS `isCultivated`, taxonoccurrence.cultivatedbasis AS `isCultivatedReason`, functions._fraction_to_percent(aggregateoccurrence.cover_fraction) AS `pctCover` FROM (((((((((((((location JOIN party datasource ON (((datasource.party_id = location.datasource_id) AND (datasource.organizationname IS NOT NULL)))) LEFT JOIN locationcoords USING (location_id)) LEFT JOIN locationplace USING (location_id)) LEFT JOIN placepath USING (placepath_id)) JOIN locationevent USING (location_id)) LEFT JOIN method USING (method_id)) JOIN taxonoccurrence USING (locationevent_id)) JOIN taxondetermination USING (taxonoccurrence_id)) LEFT JOIN party identifiedby ON ((identifiedby.party_id = taxondetermination.party_id))) JOIN taxonpath USING (taxonpath_id)) LEFT JOIN aggregateoccurrence USING (taxonoccurrence_id)) LEFT JOIN plantobservation USING (aggregateoccurrence_id)) LEFT JOIN specimenreplicate USING (plantobservation_id));
913

    
914

    
915
--
916
-- Name: classcontributor; Type: TABLE; Schema: public; Owner: -; Tablespace: 
917
--
918

    
919
CREATE TABLE classcontributor (
920
    classcontributor_id int(11) NOT NULL,
921
    commclass_id int(11) NOT NULL,
922
    party_id int(11) NOT NULL,
923
    role text
924
);
925

    
926

    
927
--
928
-- Name: classcontributor_classcontributor_id_seq; Type: SEQUENCE; Schema: public; Owner: -
929
--
930

    
931

    
932

    
933

    
934
--
935
-- Name: classcontributor_classcontributor_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
936
--
937

    
938

    
939

    
940

    
941
--
942
-- Name: commclass; Type: TABLE; Schema: public; Owner: -; Tablespace: 
943
--
944

    
945
CREATE TABLE commclass (
946
    commclass_id int(11) NOT NULL,
947
    locationevent_id int(11) NOT NULL,
948
    inspection int(1),
949
    tableanalysis int(1),
950
    multivariateanalysis int(1),
951
    classpublication_id int(11),
952
    classnotes text,
953
    commname text,
954
    commcode text,
955
    commframework text,
956
    commlevel text,
957
    classstartdate timestamp NULL,
958
    classstopdate timestamp NULL,
959
    expertsystem text,
960
    accessioncode text
961
);
962

    
963

    
964
--
965
-- Name: commclass_commclass_id_seq; Type: SEQUENCE; Schema: public; Owner: -
966
--
967

    
968

    
969

    
970

    
971
--
972
-- Name: commclass_commclass_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
973
--
974

    
975

    
976

    
977

    
978
--
979
-- Name: commconcept; Type: TABLE; Schema: public; Owner: -; Tablespace: 
980
--
981

    
982
CREATE TABLE commconcept (
983
    commconcept_id int(11) NOT NULL,
984
    commname_id int(11) NOT NULL,
985
    reference_id int(11),
986
    commdescription text,
987
    d_obscount int(11),
988
    commname text,
989
    d_currentaccepted int(1),
990
    accessioncode text
991
);
992

    
993

    
994
--
995
-- Name: commconcept_commconcept_id_seq; Type: SEQUENCE; Schema: public; Owner: -
996
--
997

    
998

    
999

    
1000

    
1001
--
1002
-- Name: commconcept_commconcept_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1003
--
1004

    
1005

    
1006

    
1007

    
1008
--
1009
-- Name: commcorrelation; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1010
--
1011

    
1012
CREATE TABLE commcorrelation (
1013
    commcorrelation_id int(11) NOT NULL,
1014
    commstatus_id int(11) NOT NULL,
1015
    commconcept_id int(11) NOT NULL,
1016
    commconvergence text NOT NULL,
1017
    correlationstart timestamp NOT NULL,
1018
    correlationstop timestamp NULL
1019
);
1020

    
1021

    
1022
--
1023
-- Name: commcorrelation_commcorrelation_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1024
--
1025

    
1026

    
1027

    
1028

    
1029
--
1030
-- Name: commcorrelation_commcorrelation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1031
--
1032

    
1033

    
1034

    
1035

    
1036
--
1037
-- Name: commdetermination; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1038
--
1039

    
1040
CREATE TABLE commdetermination (
1041
    commdetermination_id int(11) NOT NULL,
1042
    commclass_id int(11) NOT NULL,
1043
    commconcept_id int(11) NOT NULL,
1044
    commcode text,
1045
    commname text,
1046
    classfit text,
1047
    classconfidence text,
1048
    commauthority_id int(11),
1049
    notes text,
1050
    type int(1),
1051
    nomenclaturaltype int(1)
1052
);
1053

    
1054

    
1055
--
1056
-- Name: commdetermination_commdetermination_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1057
--
1058

    
1059

    
1060

    
1061

    
1062
--
1063
-- Name: commdetermination_commdetermination_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1064
--
1065

    
1066

    
1067

    
1068

    
1069
--
1070
-- Name: commlineage; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1071
--
1072

    
1073
CREATE TABLE commlineage (
1074
    commlineage_id int(11) NOT NULL,
1075
    parentcommstatus_id int(11) NOT NULL,
1076
    childcommstatus_id int(11) NOT NULL
1077
);
1078

    
1079

    
1080
--
1081
-- Name: commlineage_commlineage_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1082
--
1083

    
1084

    
1085

    
1086

    
1087
--
1088
-- Name: commlineage_commlineage_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1089
--
1090

    
1091

    
1092

    
1093

    
1094
--
1095
-- Name: commname; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1096
--
1097

    
1098
CREATE TABLE commname (
1099
    commname_id int(11) NOT NULL,
1100
    commname text NOT NULL,
1101
    reference_id int(11),
1102
    dateentered timestamp NULL 
1103
);
1104

    
1105

    
1106
--
1107
-- Name: commname_commname_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1108
--
1109

    
1110

    
1111

    
1112

    
1113
--
1114
-- Name: commname_commname_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1115
--
1116

    
1117

    
1118

    
1119

    
1120
--
1121
-- Name: commstatus; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1122
--
1123

    
1124
CREATE TABLE commstatus (
1125
    commstatus_id int(11) NOT NULL,
1126
    commconcept_id int(11) NOT NULL,
1127
    reference_id int(11),
1128
    commconceptstatus text NOT NULL,
1129
    commparent_id int(11),
1130
    commlevel text,
1131
    commpartycomments text,
1132
    party_id int(11) NOT NULL,
1133
    startdate timestamp NOT NULL,
1134
    stopdate timestamp NULL,
1135
    accessioncode text
1136
);
1137

    
1138

    
1139
--
1140
-- Name: commstatus_commstatus_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1141
--
1142

    
1143

    
1144

    
1145

    
1146
--
1147
-- Name: commstatus_commstatus_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1148
--
1149

    
1150

    
1151

    
1152

    
1153
--
1154
-- Name: commusage; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1155
--
1156

    
1157
CREATE TABLE commusage (
1158
    commusage_id int(11) NOT NULL,
1159
    commname_id int(11) NOT NULL,
1160
    commname text,
1161
    commconcept_id int(11),
1162
    commnamestatus text,
1163
    classsystem text,
1164
    party_id int(11),
1165
    commstatus_id int(11),
1166
    usagestart timestamp NULL,
1167
    usagestop timestamp NULL
1168
);
1169

    
1170

    
1171
--
1172
-- Name: commusage_commusage_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1173
--
1174

    
1175

    
1176

    
1177

    
1178
--
1179
-- Name: commusage_commusage_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1180
--
1181

    
1182

    
1183

    
1184

    
1185
--
1186
-- Name: coverindex; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1187
--
1188

    
1189
CREATE TABLE coverindex (
1190
    coverindex_id int(11) NOT NULL,
1191
    covermethod_id int(11) NOT NULL,
1192
    covercode text NOT NULL,
1193
    upperlimit double precision,
1194
    lowerlimit double precision,
1195
    coverpercent double precision NOT NULL,
1196
    indexdescription text
1197
);
1198

    
1199

    
1200
--
1201
-- Name: coverindex_coverindex_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1202
--
1203

    
1204

    
1205

    
1206

    
1207
--
1208
-- Name: coverindex_coverindex_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1209
--
1210

    
1211

    
1212

    
1213

    
1214
--
1215
-- Name: covermethod; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1216
--
1217

    
1218
CREATE TABLE covermethod (
1219
    covermethod_id int(11) NOT NULL,
1220
    reference_id int(11),
1221
    covertype text NOT NULL,
1222
    coverestimationmethod text,
1223
    accessioncode text
1224
);
1225

    
1226

    
1227
--
1228
-- Name: covermethod_covermethod_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1229
--
1230

    
1231

    
1232

    
1233

    
1234
--
1235
-- Name: covermethod_covermethod_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1236
--
1237

    
1238

    
1239

    
1240

    
1241
--
1242
-- Name: dba_preassignacccode_dba_requestnumber_seq; Type: SEQUENCE; Schema: public; Owner: -
1243
--
1244

    
1245

    
1246

    
1247

    
1248
--
1249
-- Name: definedvalue; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1250
--
1251

    
1252
CREATE TABLE definedvalue (
1253
    definedvalue_id int(11) NOT NULL,
1254
    userdefined_id int(11) NOT NULL,
1255
    tablerecord_id int(11) NOT NULL,
1256
    definedvalue text
1257
);
1258

    
1259

    
1260
--
1261
-- Name: definedvalue_definedvalue_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1262
--
1263

    
1264

    
1265

    
1266

    
1267
--
1268
-- Name: definedvalue_definedvalue_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1269
--
1270

    
1271

    
1272

    
1273

    
1274
--
1275
-- Name: disturbanceobs; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1276
--
1277

    
1278
CREATE TABLE disturbanceobs (
1279
    disturbanceobs_id int(11) NOT NULL,
1280
    locationevent_id int(11) NOT NULL,
1281
    disturbancetype text NOT NULL,
1282
    disturbanceintensity text,
1283
    disturbanceage double precision,
1284
    disturbanceextent double precision,
1285
    disturbancecomment text
1286
);
1287

    
1288

    
1289
--
1290
-- Name: disturbanceobs_disturbanceobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1291
--
1292

    
1293

    
1294

    
1295

    
1296
--
1297
-- Name: disturbanceobs_disturbanceobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1298
--
1299

    
1300

    
1301

    
1302

    
1303
--
1304
-- Name: graphic; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1305
--
1306

    
1307
CREATE TABLE graphic (
1308
    graphic_id int(11) NOT NULL,
1309
    locationevent_id int(11) NOT NULL,
1310
    graphicname text,
1311
    graphiclocation text,
1312
    graphicdescription text,
1313
    graphictype text,
1314
    graphicdata int(11),
1315
    graphicdate timestamp NULL,
1316
    accessioncode text
1317
);
1318

    
1319

    
1320
--
1321
-- Name: graphic_graphic_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1322
--
1323

    
1324

    
1325

    
1326

    
1327
--
1328
-- Name: graphic_graphic_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1329
--
1330

    
1331

    
1332

    
1333

    
1334
--
1335
-- Name: location_location_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1336
--
1337

    
1338

    
1339

    
1340

    
1341
--
1342
-- Name: location_location_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1343
--
1344

    
1345

    
1346

    
1347

    
1348
--
1349
-- Name: locationcoords_locationcoords_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1350
--
1351

    
1352

    
1353

    
1354

    
1355
--
1356
-- Name: locationcoords_locationcoords_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1357
--
1358

    
1359

    
1360

    
1361

    
1362
--
1363
-- Name: locationevent_locationevent_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1364
--
1365

    
1366

    
1367

    
1368

    
1369
--
1370
-- Name: locationevent_locationevent_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1371
--
1372

    
1373

    
1374

    
1375

    
1376
--
1377
-- Name: locationeventcontributor; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1378
--
1379

    
1380
CREATE TABLE locationeventcontributor (
1381
    locationeventcontributor_id int(11) NOT NULL,
1382
    locationevent_id int(11) NOT NULL,
1383
    party_id int(11) NOT NULL,
1384
    role text NOT NULL,
1385
    contributiondate timestamp NULL
1386
);
1387

    
1388

    
1389
--
1390
-- Name: locationeventcontributor_locationeventcontributor_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1391
--
1392

    
1393

    
1394

    
1395

    
1396
--
1397
-- Name: locationeventcontributor_locationeventcontributor_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1398
--
1399

    
1400

    
1401

    
1402

    
1403
--
1404
-- Name: locationeventsynonym; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1405
--
1406

    
1407
CREATE TABLE locationeventsynonym (
1408
    locationeventsynonym_id int(11) NOT NULL,
1409
    synonymlocationevent_id int(11) NOT NULL,
1410
    primarylocationevent_id int(11) NOT NULL,
1411
    party_id int(11) NOT NULL,
1412
    role text NOT NULL,
1413
    synonymcomment text,
1414
    classstartdate timestamp NULL  NOT NULL,
1415
    classstopdate timestamp NULL,
1416
    accessioncode text
1417
);
1418

    
1419

    
1420
--
1421
-- Name: locationeventsynonym_locationeventsynonym_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1422
--
1423

    
1424

    
1425

    
1426

    
1427
--
1428
-- Name: locationeventsynonym_locationeventsynonym_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1429
--
1430

    
1431

    
1432

    
1433

    
1434
--
1435
-- Name: locationplace_locationplace_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1436
--
1437

    
1438

    
1439

    
1440

    
1441
--
1442
-- Name: locationplace_locationplace_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1443
--
1444

    
1445

    
1446

    
1447

    
1448
--
1449
-- Name: method_method_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1450
--
1451

    
1452

    
1453

    
1454

    
1455
--
1456
-- Name: method_method_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1457
--
1458

    
1459

    
1460

    
1461

    
1462
--
1463
-- Name: methodtaxonclass; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1464
--
1465

    
1466
CREATE TABLE methodtaxonclass (
1467
    methodtaxonclass_id int(11) NOT NULL,
1468
    method_id int(11) NOT NULL,
1469
    taxonpath_id int(11),
1470
    included int(1) NOT NULL,
1471
    submethod_id int(11),
1472
    taxonclass text
1473
);
1474

    
1475

    
1476
--
1477
-- Name: COLUMN methodtaxonclass.included; Type: COMMENT; Schema: public; Owner: -
1478
--
1479

    
1480

    
1481

    
1482

    
1483
--
1484
-- Name: COLUMN methodtaxonclass.submethod_id; Type: COMMENT; Schema: public; Owner: -
1485
--
1486

    
1487

    
1488

    
1489

    
1490
--
1491
-- Name: methodtaxonclass_methodtaxonclass_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1492
--
1493

    
1494

    
1495

    
1496

    
1497
--
1498
-- Name: methodtaxonclass_methodtaxonclass_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1499
--
1500

    
1501

    
1502

    
1503

    
1504
--
1505
-- Name: note; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1506
--
1507

    
1508
CREATE TABLE note (
1509
    note_id int(11) NOT NULL,
1510
    notelink_id int(11) NOT NULL,
1511
    party_id int(11) NOT NULL,
1512
    role text NOT NULL,
1513
    notetype text NOT NULL,
1514
    notetext text NOT NULL,
1515
    notedate timestamp NULL,
1516
    accessioncode text
1517
);
1518

    
1519

    
1520
--
1521
-- Name: note_note_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1522
--
1523

    
1524

    
1525

    
1526

    
1527
--
1528
-- Name: note_note_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1529
--
1530

    
1531

    
1532

    
1533

    
1534
--
1535
-- Name: notelink; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1536
--
1537

    
1538
CREATE TABLE notelink (
1539
    notelink_id int(11) NOT NULL,
1540
    tablename text NOT NULL,
1541
    attributename text,
1542
    tablerecord int(11) NOT NULL
1543
);
1544

    
1545

    
1546
--
1547
-- Name: notelink_notelink_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1548
--
1549

    
1550

    
1551

    
1552

    
1553
--
1554
-- Name: notelink_notelink_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1555
--
1556

    
1557

    
1558

    
1559

    
1560
--
1561
-- Name: party_party_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1562
--
1563

    
1564

    
1565

    
1566

    
1567
--
1568
-- Name: party_party_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1569
--
1570

    
1571

    
1572

    
1573

    
1574
--
1575
-- Name: partymember; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1576
--
1577

    
1578
CREATE TABLE partymember (
1579
    partymember_id int(11) NOT NULL,
1580
    parentparty_id int(11) NOT NULL,
1581
    childparty_id int(11) NOT NULL,
1582
    role text,
1583
    memberstart timestamp NULL  NOT NULL,
1584
    memberstop timestamp NULL
1585
);
1586

    
1587

    
1588
--
1589
-- Name: partymember_partymember_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1590
--
1591

    
1592

    
1593

    
1594

    
1595
--
1596
-- Name: partymember_partymember_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1597
--
1598

    
1599

    
1600

    
1601

    
1602
--
1603
-- Name: place; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1604
--
1605

    
1606
CREATE TABLE place (
1607
    place_id int(11) NOT NULL,
1608
    parent_id int(11),
1609
    rank text NOT NULL,
1610
    placename text NOT NULL,
1611
    placecode text,
1612
    placedescription text,
1613
    accessioncode text
1614
);
1615

    
1616

    
1617
--
1618
-- Name: TABLE place; Type: COMMENT; Schema: public; Owner: -
1619
--
1620

    
1621

    
1622

    
1623

    
1624
--
1625
-- Name: place_ancestor; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1626
--
1627

    
1628
CREATE TABLE place_ancestor (
1629
    place_id int(11) NOT NULL,
1630
    ancestor_id int(11) NOT NULL
1631
);
1632

    
1633

    
1634
--
1635
-- Name: place_place_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1636
--
1637

    
1638

    
1639

    
1640

    
1641
--
1642
-- Name: place_place_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1643
--
1644

    
1645

    
1646

    
1647

    
1648
--
1649
-- Name: placecorrelation; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1650
--
1651

    
1652
CREATE TABLE placecorrelation (
1653
    placecorrelation_id int(11) NOT NULL,
1654
    parentplace_id int(11) NOT NULL,
1655
    childplace_id int(11) NOT NULL,
1656
    placeconvergence text NOT NULL
1657
);
1658

    
1659

    
1660
--
1661
-- Name: placecorrelation_placecorrelation_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1662
--
1663

    
1664

    
1665

    
1666

    
1667
--
1668
-- Name: placecorrelation_placecorrelation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1669
--
1670

    
1671

    
1672

    
1673

    
1674
--
1675
-- Name: placepath_placepath_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1676
--
1677

    
1678

    
1679

    
1680

    
1681
--
1682
-- Name: placepath_placepath_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1683
--
1684

    
1685

    
1686

    
1687

    
1688
--
1689
-- Name: plant; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1690
--
1691

    
1692
CREATE TABLE plant (
1693
    plant_id int(11) NOT NULL
1694
);
1695

    
1696

    
1697
--
1698
-- Name: TABLE plant; Type: COMMENT; Schema: public; Owner: -
1699
--
1700

    
1701

    
1702

    
1703

    
1704
--
1705
-- Name: plant_plant_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1706
--
1707

    
1708

    
1709

    
1710

    
1711
--
1712
-- Name: plant_plant_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1713
--
1714

    
1715

    
1716

    
1717

    
1718
--
1719
-- Name: plantcorrelation; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1720
--
1721

    
1722
CREATE TABLE plantcorrelation (
1723
    plantcorrelation_id int(11) NOT NULL,
1724
    plantstatus_id int(11) NOT NULL,
1725
    taxonpath_id int(11) NOT NULL,
1726
    plantconvergence text NOT NULL,
1727
    correlationstart timestamp NOT NULL,
1728
    correlationstop timestamp NULL
1729
);
1730

    
1731

    
1732
--
1733
-- Name: plantcorrelation_plantcorrelation_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1734
--
1735

    
1736

    
1737

    
1738

    
1739
--
1740
-- Name: plantcorrelation_plantcorrelation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1741
--
1742

    
1743

    
1744

    
1745

    
1746
--
1747
-- Name: plantlineage; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1748
--
1749

    
1750
CREATE TABLE plantlineage (
1751
    plantlineage_id int(11) NOT NULL,
1752
    childplantstatus_id int(11) NOT NULL,
1753
    parentplantstatus_id int(11) NOT NULL
1754
);
1755

    
1756

    
1757
--
1758
-- Name: plantlineage_plantlineage_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1759
--
1760

    
1761

    
1762

    
1763

    
1764
--
1765
-- Name: plantlineage_plantlineage_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1766
--
1767

    
1768

    
1769

    
1770

    
1771
--
1772
-- Name: plantobservation_plantobservation_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1773
--
1774

    
1775

    
1776

    
1777

    
1778
--
1779
-- Name: plantobservation_plantobservation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1780
--
1781

    
1782

    
1783

    
1784

    
1785
--
1786
-- Name: plantstatus; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1787
--
1788

    
1789
CREATE TABLE plantstatus (
1790
    plantstatus_id int(11) NOT NULL,
1791
    taxonpath_id int(11) NOT NULL,
1792
    party_id int(11),
1793
    taxonpathstatus text DEFAULT 'undetermined' NOT NULL,
1794
    reference_id int(11),
1795
    plantpartycomments text,
1796
    startdate timestamp NULL,
1797
    stopdate timestamp NULL,
1798
    accessioncode text
1799
);
1800

    
1801

    
1802
--
1803
-- Name: plantstatus_plantstatus_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1804
--
1805

    
1806

    
1807

    
1808

    
1809
--
1810
-- Name: plantstatus_plantstatus_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1811
--
1812

    
1813

    
1814

    
1815

    
1816
--
1817
-- Name: plantusage; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1818
--
1819

    
1820
CREATE TABLE plantusage (
1821
    plantusage_id int(11) NOT NULL,
1822
    taxon_id int(11) NOT NULL,
1823
    taxonpath_id int(11),
1824
    taxonstatus text,
1825
    taxon text,
1826
    classsystem text,
1827
    acceptedsynonym text,
1828
    party_id int(11),
1829
    plantstatus_id int(11),
1830
    usagestart timestamp NULL,
1831
    usagestop timestamp NULL
1832
);
1833

    
1834

    
1835
--
1836
-- Name: plantusage_plantusage_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1837
--
1838

    
1839

    
1840

    
1841

    
1842
--
1843
-- Name: plantusage_plantusage_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1844
--
1845

    
1846

    
1847

    
1848

    
1849
--
1850
-- Name: project; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1851
--
1852

    
1853
CREATE TABLE project (
1854
    project_id int(11) NOT NULL,
1855
    datasource_id int(11) NOT NULL,
1856
    sourceaccessioncode text,
1857
    projectname text,
1858
    projectdescription text,
1859
    startdate timestamp NULL,
1860
    stopdate timestamp NULL,
1861
    d_obscount int(11),
1862
    d_lastlocationaddeddate timestamp NULL,
1863
    accessioncode text
1864
);
1865

    
1866

    
1867
--
1868
-- Name: project_project_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1869
--
1870

    
1871

    
1872

    
1873

    
1874
--
1875
-- Name: project_project_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1876
--
1877

    
1878

    
1879

    
1880

    
1881
--
1882
-- Name: projectcontributor; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1883
--
1884

    
1885
CREATE TABLE projectcontributor (
1886
    projectcontributor_id int(11) NOT NULL,
1887
    project_id int(11) NOT NULL,
1888
    party_id int(11) NOT NULL,
1889
    role text,
1890
    surname text,
1891
    cheatrole text
1892
);
1893

    
1894

    
1895
--
1896
-- Name: projectcontributor_projectcontributor_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1897
--
1898

    
1899

    
1900

    
1901

    
1902
--
1903
-- Name: projectcontributor_projectcontributor_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1904
--
1905

    
1906

    
1907

    
1908

    
1909
--
1910
-- Name: reference; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1911
--
1912

    
1913
CREATE TABLE reference (
1914
    reference_id int(11) NOT NULL,
1915
    shortname text,
1916
    fulltext__ text,
1917
    referencetype text,
1918
    title text,
1919
    titlesuperior text,
1920
    referencejournal_id int(11),
1921
    volume text,
1922
    issue text,
1923
    pagerange text,
1924
    totalpages int(11),
1925
    publisher text,
1926
    publicationplace text,
1927
    isbn text,
1928
    edition text,
1929
    numberofvolumes int(11),
1930
    chapternumber int(11),
1931
    reportnumber int(11),
1932
    communicationtype text,
1933
    degree text,
1934
    url text,
1935
    doi text,
1936
    additionalinfo text,
1937
    pubdate timestamp NULL,
1938
    accessdate timestamp NULL,
1939
    conferencedate timestamp NULL,
1940
    accessioncode text
1941
);
1942

    
1943

    
1944
--
1945
-- Name: reference_reference_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1946
--
1947

    
1948

    
1949

    
1950

    
1951
--
1952
-- Name: reference_reference_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1953
--
1954

    
1955

    
1956

    
1957

    
1958
--
1959
-- Name: referencealtident; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1960
--
1961

    
1962
CREATE TABLE referencealtident (
1963
    referencealtident_id int(11) NOT NULL,
1964
    reference_id int(11) NOT NULL,
1965
    system text,
1966
    identifier text NOT NULL
1967
);
1968

    
1969

    
1970
--
1971
-- Name: referencealtident_referencealtident_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1972
--
1973

    
1974

    
1975

    
1976

    
1977
--
1978
-- Name: referencealtident_referencealtident_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1979
--
1980

    
1981

    
1982

    
1983

    
1984
--
1985
-- Name: referencecontributor; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1986
--
1987

    
1988
CREATE TABLE referencecontributor (
1989
    referencecontributor_id int(11) NOT NULL,
1990
    reference_id int(11) NOT NULL,
1991
    referenceparty_id int(11) NOT NULL,
1992
    roletype text,
1993
    `position` int(11)
1994
);
1995

    
1996

    
1997
--
1998
-- Name: referencecontributor_referencecontributor_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1999
--
2000

    
2001

    
2002

    
2003

    
2004
--
2005
-- Name: referencecontributor_referencecontributor_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
2006
--
2007

    
2008

    
2009

    
2010

    
2011
--
2012
-- Name: referencejournal; Type: TABLE; Schema: public; Owner: -; Tablespace: 
2013
--
2014

    
2015
CREATE TABLE referencejournal (
2016
    referencejournal_id int(11) NOT NULL,
2017
    journal text NOT NULL,
2018
    issn text,
2019
    abbreviation text,
2020
    accessioncode text
2021
);
2022

    
2023

    
2024
--
2025
-- Name: referencejournal_referencejournal_id_seq; Type: SEQUENCE; Schema: public; Owner: -
2026
--
2027

    
2028

    
2029

    
2030

    
2031
--
2032
-- Name: referencejournal_referencejournal_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
2033
--
2034

    
2035

    
2036

    
2037

    
2038
--
2039
-- Name: referenceparty; Type: TABLE; Schema: public; Owner: -; Tablespace: 
2040
--
2041

    
2042
CREATE TABLE referenceparty (
2043
    referenceparty_id int(11) NOT NULL,
2044
    type text,
2045
    positionname text,
2046
    salutation text,
2047
    givenname text,
2048
    surname text,
2049
    suffix text,
2050
    organizationname text,
2051
    currentparty_id int(11),
2052
    accessioncode text
2053
);
2054

    
2055

    
2056
--
2057
-- Name: referenceparty_referenceparty_id_seq; Type: SEQUENCE; Schema: public; Owner: -
2058
--
2059

    
2060

    
2061

    
2062

    
2063
--
2064
-- Name: referenceparty_referenceparty_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
2065
--
2066

    
2067

    
2068

    
2069

    
2070
--
2071
-- Name: revision; Type: TABLE; Schema: public; Owner: -; Tablespace: 
2072
--
2073

    
2074
CREATE TABLE revision (
2075
    revision_id int(11) NOT NULL,
2076
    tablename text NOT NULL,
2077
    tableattribute text NOT NULL,
2078
    tablerecord int(11) NOT NULL,
2079
    previousvaluetext text NOT NULL,
2080
    previousvaluetype text NOT NULL,
2081
    previousrevision_id int(11),
2082
    revisiondate timestamp NOT NULL
2083
);
2084

    
2085

    
2086
--
2087
-- Name: revision_revision_id_seq; Type: SEQUENCE; Schema: public; Owner: -
2088
--
2089

    
2090

    
2091

    
2092

    
2093
--
2094
-- Name: revision_revision_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
2095
--
2096

    
2097

    
2098

    
2099

    
2100
--
2101
-- Name: soilobs; Type: TABLE; Schema: public; Owner: -; Tablespace: 
2102
--
2103

    
2104
CREATE TABLE soilobs (
2105
    soilobs_id int(11) NOT NULL,
2106
    locationevent_id int(11) NOT NULL,
2107
    horizon text DEFAULT 'unknown' NOT NULL,
2108
    description text,
2109
    depthtop_m double precision,
2110
    depthbottom_m double precision,
2111
    color text,
2112
    texture text,
2113
    organic_fraction double precision,
2114
    sand_fraction double precision,
2115
    silt_fraction double precision,
2116
    clay_fraction double precision,
2117
    coarse_fraction double precision,
2118
    ph double precision,
2119
    acidity_fraction double precision,
2120
    basesaturation_fraction double precision,
2121
    cationexchangecapacity_cmol_kg double precision,
2122
    conductivity double precision,
2123
    carbon_fraction double precision,
2124
    phosphorus_fraction double precision,
2125
    potassium_fraction double precision,
2126
    magnesium_fraction double precision,
2127
    nitrogen_fraction double precision,
2128
    calcium_fraction double precision,
2129
    sodium_fraction double precision
2130
);
2131

    
2132

    
2133
--
2134
-- Name: COLUMN soilobs.organic_fraction; Type: COMMENT; Schema: public; Owner: -
2135
--
2136

    
2137

    
2138

    
2139

    
2140
--
2141
-- Name: COLUMN soilobs.sand_fraction; Type: COMMENT; Schema: public; Owner: -
2142
--
2143

    
2144

    
2145

    
2146

    
2147
--
2148
-- Name: COLUMN soilobs.silt_fraction; Type: COMMENT; Schema: public; Owner: -
2149
--
2150

    
2151

    
2152

    
2153

    
2154
--
2155
-- Name: COLUMN soilobs.clay_fraction; Type: COMMENT; Schema: public; Owner: -
2156
--
2157

    
2158

    
2159

    
2160

    
2161
--
2162
-- Name: COLUMN soilobs.coarse_fraction; Type: COMMENT; Schema: public; Owner: -
2163
--
2164

    
2165

    
2166

    
2167

    
2168
--
2169
-- Name: COLUMN soilobs.acidity_fraction; Type: COMMENT; Schema: public; Owner: -
2170
--
2171

    
2172

    
2173

    
2174

    
2175
--
2176
-- Name: COLUMN soilobs.basesaturation_fraction; Type: COMMENT; Schema: public; Owner: -
2177
--
2178

    
2179

    
2180

    
2181

    
2182
--
2183
-- Name: COLUMN soilobs.carbon_fraction; Type: COMMENT; Schema: public; Owner: -
2184
--
2185

    
2186

    
2187

    
2188

    
2189
--
2190
-- Name: COLUMN soilobs.phosphorus_fraction; Type: COMMENT; Schema: public; Owner: -
2191
--
2192

    
2193

    
2194

    
2195

    
2196
--
2197
-- Name: COLUMN soilobs.potassium_fraction; Type: COMMENT; Schema: public; Owner: -
2198
--
2199

    
2200

    
2201

    
2202

    
2203
--
2204
-- Name: COLUMN soilobs.magnesium_fraction; Type: COMMENT; Schema: public; Owner: -
2205
--
2206

    
2207

    
2208

    
2209

    
2210
--
2211
-- Name: COLUMN soilobs.nitrogen_fraction; Type: COMMENT; Schema: public; Owner: -
2212
--
2213

    
2214

    
2215

    
2216

    
2217
--
2218
-- Name: COLUMN soilobs.calcium_fraction; Type: COMMENT; Schema: public; Owner: -
2219
--
2220

    
2221

    
2222

    
2223

    
2224
--
2225
-- Name: COLUMN soilobs.sodium_fraction; Type: COMMENT; Schema: public; Owner: -
2226
--
2227

    
2228

    
2229

    
2230

    
2231
--
2232
-- Name: soilobs_soilobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
2233
--
2234

    
2235

    
2236

    
2237

    
2238
--
2239
-- Name: soilobs_soilobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
2240
--
2241

    
2242

    
2243

    
2244

    
2245
--
2246
-- Name: soiltaxon; Type: TABLE; Schema: public; Owner: -; Tablespace: 
2247
--
2248

    
2249
CREATE TABLE soiltaxon (
2250
    soiltaxon_id int(11) NOT NULL,
2251
    soilcode text,
2252
    soilname text,
2253
    soillevel int(11),
2254
    soilparent_id int(11),
2255
    soilframework text,
2256
    accessioncode text
2257
);
2258

    
2259

    
2260
--
2261
-- Name: soiltaxon_soiltaxon_id_seq; Type: SEQUENCE; Schema: public; Owner: -
2262
--
2263

    
2264

    
2265

    
2266

    
2267
--
2268
-- Name: soiltaxon_soiltaxon_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
2269
--
2270

    
2271

    
2272

    
2273

    
2274
--
2275
-- Name: specimen; Type: TABLE; Schema: public; Owner: -; Tablespace: 
2276
--
2277

    
2278
CREATE TABLE specimen (
2279
    specimen_id int(11) NOT NULL
2280
);
2281

    
2282

    
2283
--
2284
-- Name: TABLE specimen; Type: COMMENT; Schema: public; Owner: -
2285
--
2286

    
2287

    
2288

    
2289

    
2290
--
2291
-- Name: specimen_specimen_id_seq; Type: SEQUENCE; Schema: public; Owner: -
2292
--
2293

    
2294

    
2295

    
2296

    
2297
--
2298
-- Name: specimen_specimen_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
2299
--
2300

    
2301

    
2302

    
2303

    
2304
--
2305
-- Name: specimenreplicate_specimenreplicate_id_seq; Type: SEQUENCE; Schema: public; Owner: -
2306
--
2307

    
2308

    
2309

    
2310

    
2311
--
2312
-- Name: specimenreplicate_specimenreplicate_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
2313
--
2314

    
2315

    
2316

    
2317

    
2318
--
2319
-- Name: stemobservation; Type: TABLE; Schema: public; Owner: -; Tablespace: 
2320
--
2321

    
2322
CREATE TABLE stemobservation (
2323
    stemobservation_id int(11) NOT NULL,
2324
    datasource_id int(11) NOT NULL,
2325
    sourceaccessioncode text,
2326
    plantobservation_id int(11) NOT NULL,
2327
    authorstemcode text,
2328
    tag text,
2329
    tags text,
2330
    xposition_m double precision,
2331
    yposition_m double precision,
2332
    diameterbreastheight_m double precision,
2333
    basaldiameter_m double precision,
2334
    diameteraccuracy_m double precision,
2335
    height_m double precision,
2336
    heightfirstbranch_m double precision,
2337
    heightaccuracy_m double precision,
2338
    health text,
2339
    age double precision,
2340
    accessioncode text
2341
);
2342

    
2343

    
2344
--
2345
-- Name: TABLE stemobservation; Type: COMMENT; Schema: public; Owner: -
2346
--
2347

    
2348

    
2349

    
2350

    
2351
--
2352
-- Name: COLUMN stemobservation.tags; Type: COMMENT; Schema: public; Owner: -
2353
--
2354

    
2355

    
2356

    
2357

    
2358
--
2359
-- Name: stemobservation_stemobservation_id_seq; Type: SEQUENCE; Schema: public; Owner: -
2360
--
2361

    
2362

    
2363

    
2364

    
2365
--
2366
-- Name: stemobservation_stemobservation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
2367
--
2368

    
2369

    
2370

    
2371

    
2372
--
2373
-- Name: stratum; Type: TABLE; Schema: public; Owner: -; Tablespace: 
2374
--
2375

    
2376
CREATE TABLE stratum (
2377
    stratum_id int(11) NOT NULL,
2378
    locationevent_id int(11) NOT NULL,
2379
    stratumheight double precision,
2380
    stratumbase double precision,
2381
    stratumcover double precision,
2382
    area double precision,
2383
    method_id int(11)
2384
);
2385

    
2386

    
2387
--
2388
-- Name: stratum_stratum_id_seq; Type: SEQUENCE; Schema: public; Owner: -
2389
--
2390

    
2391

    
2392

    
2393

    
2394
--
2395
-- Name: stratum_stratum_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
2396
--
2397

    
2398

    
2399

    
2400

    
2401
--
2402
-- Name: taxon; Type: TABLE; Schema: public; Owner: -; Tablespace: 
2403
--
2404

    
2405
CREATE TABLE taxon (
2406
    taxon_id int(11) NOT NULL,
2407
    parent_id int(11),
2408
    rank text NOT NULL,
2409
    verbatimrank text,
2410
    taxonname text NOT NULL,
2411
    author_id int(11),
2412
    authority_id int(11),
2413
    description text,
2414
    accessioncode text
2415
);
2416

    
2417

    
2418
--
2419
-- Name: TABLE taxon; Type: COMMENT; Schema: public; Owner: -
2420
--
2421

    
2422

    
2423

    
2424

    
2425
--
2426
-- Name: COLUMN taxon.rank; Type: COMMENT; Schema: public; Owner: -
2427
--
2428

    
2429

    
2430

    
2431

    
2432
--
2433
-- Name: COLUMN taxon.author_id; Type: COMMENT; Schema: public; Owner: -
2434
--
2435

    
2436

    
2437

    
2438

    
2439
--
2440
-- Name: COLUMN taxon.authority_id; Type: COMMENT; Schema: public; Owner: -
2441
--
2442

    
2443

    
2444

    
2445

    
2446
--
2447
-- Name: taxon_ancestor; Type: TABLE; Schema: public; Owner: -; Tablespace: 
2448
--
2449

    
2450
CREATE TABLE taxon_ancestor (
2451
    taxon_id int(11) NOT NULL,
2452
    ancestor_id int(11) NOT NULL
2453
);
2454

    
2455

    
2456
--
2457
-- Name: taxon_taxon_id_seq; Type: SEQUENCE; Schema: public; Owner: -
2458
--
2459

    
2460

    
2461

    
2462

    
2463
--
2464
-- Name: taxon_taxon_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
2465
--
2466

    
2467

    
2468

    
2469

    
2470
--
2471
-- Name: taxonalt; Type: TABLE; Schema: public; Owner: -; Tablespace: 
2472
--
2473

    
2474
CREATE TABLE taxonalt (
2475
    taxonalt_id int(11) NOT NULL,
2476
    taxondetermination_id int(11) NOT NULL,
2477
    taxonpath_id int(11) NOT NULL,
2478
    taxonaltfit text,
2479
    taxonaltconfidence text,
2480
    taxonaltnotes text
2481
);
2482

    
2483

    
2484
--
2485
-- Name: taxonalt_taxonalt_id_seq; Type: SEQUENCE; Schema: public; Owner: -
2486
--
2487

    
2488

    
2489

    
2490

    
2491
--
2492
-- Name: taxonalt_taxonalt_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
2493
--
2494

    
2495

    
2496

    
2497

    
2498
--
2499
-- Name: taxondetermination_taxondetermination_id_seq; Type: SEQUENCE; Schema: public; Owner: -
2500
--
2501

    
2502

    
2503

    
2504

    
2505
--
2506
-- Name: taxondetermination_taxondetermination_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
2507
--
2508

    
2509

    
2510

    
2511

    
2512
--
2513
-- Name: taxonoccurrence_taxonoccurrence_id_seq; Type: SEQUENCE; Schema: public; Owner: -
2514
--
2515

    
2516

    
2517

    
2518

    
2519
--
2520
-- Name: taxonoccurrence_taxonoccurrence_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
2521
--
2522

    
2523

    
2524

    
2525

    
2526
--
2527
-- Name: taxonpath_taxonpath_id_seq; Type: SEQUENCE; Schema: public; Owner: -
2528
--
2529

    
2530

    
2531

    
2532

    
2533
--
2534
-- Name: taxonpath_taxonpath_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
2535
--
2536

    
2537

    
2538

    
2539

    
2540
--
2541
-- Name: taxonscope; Type: TABLE; Schema: public; Owner: -; Tablespace: 
2542
--
2543

    
2544
CREATE TABLE taxonscope (
2545
    taxonscope_id int(11) NOT NULL,
2546
    locationevent_id int(11),
2547
    project_id int(11),
2548
    place_id int(11)
2549
);
2550

    
2551

    
2552
--
2553
-- Name: TABLE taxonscope; Type: COMMENT; Schema: public; Owner: -
2554
--
2555

    
2556

    
2557

    
2558

    
2559
--
2560
-- Name: taxonscope_taxonscope_id_seq; Type: SEQUENCE; Schema: public; Owner: -
2561
--
2562

    
2563

    
2564

    
2565

    
2566
--
2567
-- Name: taxonscope_taxonscope_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
2568
--
2569

    
2570

    
2571

    
2572

    
2573
--
2574
-- Name: telephone; Type: TABLE; Schema: public; Owner: -; Tablespace: 
2575
--
2576

    
2577
CREATE TABLE telephone (
2578
    telephone_id int(11) NOT NULL,
2579
    party_id int(11) NOT NULL,
2580
    phonenumber text NOT NULL,
2581
    phonetype text NOT NULL
2582
);
2583

    
2584

    
2585
--
2586
-- Name: telephone_telephone_id_seq; Type: SEQUENCE; Schema: public; Owner: -
2587
--
2588

    
2589

    
2590

    
2591

    
2592
--
2593
-- Name: telephone_telephone_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
2594
--
2595

    
2596

    
2597

    
2598

    
2599
--
2600
-- Name: trait; Type: TABLE; Schema: public; Owner: -; Tablespace: 
2601
--
2602

    
2603
CREATE TABLE trait (
2604
    trait_id int(11) NOT NULL,
2605
    stemobservation_id int(11) NOT NULL,
2606
    type text NOT NULL,
2607
    value text
2608
);
2609

    
2610

    
2611
--
2612
-- Name: trait_trait_id_seq; Type: SEQUENCE; Schema: public; Owner: -
2613
--
2614

    
2615

    
2616

    
2617

    
2618
--
2619
-- Name: trait_trait_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
2620
--
2621

    
2622

    
2623

    
2624

    
2625
--
2626
-- Name: userdefined; Type: TABLE; Schema: public; Owner: -; Tablespace: 
2627
--
2628

    
2629
CREATE TABLE userdefined (
2630
    userdefined_id int(11) NOT NULL,
2631
    userdefinedname text NOT NULL,
2632
    userdefinedmetadata text,
2633
    userdefinedcategory text,
2634
    userdefinedtype text DEFAULT 'text' NOT NULL,
2635
    tablename text NOT NULL,
2636
    accessioncode text
2637
);
2638

    
2639

    
2640
--
2641
-- Name: userdefined_userdefined_id_seq; Type: SEQUENCE; Schema: public; Owner: -
2642
--
2643

    
2644

    
2645

    
2646

    
2647
--
2648
-- Name: userdefined_userdefined_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
2649
--
2650

    
2651

    
2652

    
2653

    
2654
--
2655
-- Name: voucher; Type: TABLE; Schema: public; Owner: -; Tablespace: 
2656
--
2657

    
2658
CREATE TABLE voucher (
2659
    voucher_id int(11) NOT NULL,
2660
    taxonoccurrence_id int(11) NOT NULL,
2661
    specimenreplicate_id int(11) NOT NULL,
2662
    accessioncode text
2663
);
2664

    
2665

    
2666
--
2667
-- Name: voucher_voucher_id_seq; Type: SEQUENCE; Schema: public; Owner: -
2668
--
2669

    
2670

    
2671

    
2672

    
2673
--
2674
-- Name: voucher_voucher_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
2675
--
2676

    
2677

    
2678

    
2679

    
2680
--
2681
-- Name: address_id; Type: DEFAULT; Schema: public; Owner: -
2682
--
2683

    
2684

    
2685

    
2686

    
2687
--
2688
-- Name: aggregateoccurrence_id; Type: DEFAULT; Schema: public; Owner: -
2689
--
2690

    
2691

    
2692

    
2693

    
2694
--
2695
-- Name: classcontributor_id; Type: DEFAULT; Schema: public; Owner: -
2696
--
2697

    
2698

    
2699

    
2700

    
2701
--
2702
-- Name: commclass_id; Type: DEFAULT; Schema: public; Owner: -
2703
--
2704

    
2705

    
2706

    
2707

    
2708
--
2709
-- Name: commconcept_id; Type: DEFAULT; Schema: public; Owner: -
2710
--
2711

    
2712

    
2713

    
2714

    
2715
--
2716
-- Name: commcorrelation_id; Type: DEFAULT; Schema: public; Owner: -
2717
--
2718

    
2719

    
2720

    
2721

    
2722
--
2723
-- Name: commdetermination_id; Type: DEFAULT; Schema: public; Owner: -
2724
--
2725

    
2726

    
2727

    
2728

    
2729
--
2730
-- Name: commlineage_id; Type: DEFAULT; Schema: public; Owner: -
2731
--
2732

    
2733

    
2734

    
2735

    
2736
--
2737
-- Name: commname_id; Type: DEFAULT; Schema: public; Owner: -
2738
--
2739

    
2740

    
2741

    
2742

    
2743
--
2744
-- Name: commstatus_id; Type: DEFAULT; Schema: public; Owner: -
2745
--
2746

    
2747

    
2748

    
2749

    
2750
--
2751
-- Name: commusage_id; Type: DEFAULT; Schema: public; Owner: -
2752
--
2753

    
2754

    
2755

    
2756

    
2757
--
2758
-- Name: coverindex_id; Type: DEFAULT; Schema: public; Owner: -
2759
--
2760

    
2761

    
2762

    
2763

    
2764
--
2765
-- Name: covermethod_id; Type: DEFAULT; Schema: public; Owner: -
2766
--
2767

    
2768

    
2769

    
2770

    
2771
--
2772
-- Name: definedvalue_id; Type: DEFAULT; Schema: public; Owner: -
2773
--
2774

    
2775

    
2776

    
2777

    
2778
--
2779
-- Name: disturbanceobs_id; Type: DEFAULT; Schema: public; Owner: -
2780
--
2781

    
2782

    
2783

    
2784

    
2785
--
2786
-- Name: graphic_id; Type: DEFAULT; Schema: public; Owner: -
2787
--
2788

    
2789

    
2790

    
2791

    
2792
--
2793
-- Name: location_id; Type: DEFAULT; Schema: public; Owner: -
2794
--
2795

    
2796

    
2797

    
2798

    
2799
--
2800
-- Name: locationcoords_id; Type: DEFAULT; Schema: public; Owner: -
2801
--
2802

    
2803

    
2804

    
2805

    
2806
--
2807
-- Name: locationevent_id; Type: DEFAULT; Schema: public; Owner: -
2808
--
2809

    
2810

    
2811

    
2812

    
2813
--
2814
-- Name: locationeventcontributor_id; Type: DEFAULT; Schema: public; Owner: -
2815
--
2816

    
2817

    
2818

    
2819

    
2820
--
2821
-- Name: locationeventsynonym_id; Type: DEFAULT; Schema: public; Owner: -
2822
--
2823

    
2824

    
2825

    
2826

    
2827
--
2828
-- Name: locationplace_id; Type: DEFAULT; Schema: public; Owner: -
2829
--
2830

    
2831

    
2832

    
2833

    
2834
--
2835
-- Name: method_id; Type: DEFAULT; Schema: public; Owner: -
2836
--
2837

    
2838

    
2839

    
2840

    
2841
--
2842
-- Name: methodtaxonclass_id; Type: DEFAULT; Schema: public; Owner: -
2843
--
2844

    
2845

    
2846

    
2847

    
2848
--
2849
-- Name: note_id; Type: DEFAULT; Schema: public; Owner: -
2850
--
2851

    
2852

    
2853

    
2854

    
2855
--
2856
-- Name: notelink_id; Type: DEFAULT; Schema: public; Owner: -
2857
--
2858

    
2859

    
2860

    
2861

    
2862
--
2863
-- Name: party_id; Type: DEFAULT; Schema: public; Owner: -
2864
--
2865

    
2866

    
2867

    
2868

    
2869
--
2870
-- Name: partymember_id; Type: DEFAULT; Schema: public; Owner: -
2871
--
2872

    
2873

    
2874

    
2875

    
2876
--
2877
-- Name: place_id; Type: DEFAULT; Schema: public; Owner: -
2878
--
2879

    
2880

    
2881

    
2882

    
2883
--
2884
-- Name: placecorrelation_id; Type: DEFAULT; Schema: public; Owner: -
2885
--
2886

    
2887

    
2888

    
2889

    
2890
--
2891
-- Name: placepath_id; Type: DEFAULT; Schema: public; Owner: -
2892
--
2893

    
2894

    
2895

    
2896

    
2897
--
2898
-- Name: plant_id; Type: DEFAULT; Schema: public; Owner: -
2899
--
2900

    
2901

    
2902

    
2903

    
2904
--
2905
-- Name: plantcorrelation_id; Type: DEFAULT; Schema: public; Owner: -
2906
--
2907

    
2908

    
2909

    
2910

    
2911
--
2912
-- Name: plantlineage_id; Type: DEFAULT; Schema: public; Owner: -
2913
--
2914

    
2915

    
2916

    
2917

    
2918
--
2919
-- Name: plantobservation_id; Type: DEFAULT; Schema: public; Owner: -
2920
--
2921

    
2922

    
2923

    
2924

    
2925
--
2926
-- Name: plantstatus_id; Type: DEFAULT; Schema: public; Owner: -
2927
--
2928

    
2929

    
2930

    
2931

    
2932
--
2933
-- Name: plantusage_id; Type: DEFAULT; Schema: public; Owner: -
2934
--
2935

    
2936

    
2937

    
2938

    
2939
--
2940
-- Name: project_id; Type: DEFAULT; Schema: public; Owner: -
2941
--
2942

    
2943

    
2944

    
2945

    
2946
--
2947
-- Name: projectcontributor_id; Type: DEFAULT; Schema: public; Owner: -
2948
--
2949

    
2950

    
2951

    
2952

    
2953
--
2954
-- Name: reference_id; Type: DEFAULT; Schema: public; Owner: -
2955
--
2956

    
2957

    
2958

    
2959

    
2960
--
2961
-- Name: referencealtident_id; Type: DEFAULT; Schema: public; Owner: -
2962
--
2963

    
2964

    
2965

    
2966

    
2967
--
2968
-- Name: referencecontributor_id; Type: DEFAULT; Schema: public; Owner: -
2969
--
2970

    
2971

    
2972

    
2973

    
2974
--
2975
-- Name: referencejournal_id; Type: DEFAULT; Schema: public; Owner: -
2976
--
2977

    
2978

    
2979

    
2980

    
2981
--
2982
-- Name: referenceparty_id; Type: DEFAULT; Schema: public; Owner: -
2983
--
2984

    
2985

    
2986

    
2987

    
2988
--
2989
-- Name: revision_id; Type: DEFAULT; Schema: public; Owner: -
2990
--
2991

    
2992

    
2993

    
2994

    
2995
--
2996
-- Name: soilobs_id; Type: DEFAULT; Schema: public; Owner: -
2997
--
2998

    
2999

    
3000

    
3001

    
3002
--
3003
-- Name: soiltaxon_id; Type: DEFAULT; Schema: public; Owner: -
3004
--
3005

    
3006

    
3007

    
3008

    
3009
--
3010
-- Name: specimen_id; Type: DEFAULT; Schema: public; Owner: -
3011
--
3012

    
3013

    
3014

    
3015

    
3016
--
3017
-- Name: specimenreplicate_id; Type: DEFAULT; Schema: public; Owner: -
3018
--
3019

    
3020

    
3021

    
3022

    
3023
--
3024
-- Name: stemobservation_id; Type: DEFAULT; Schema: public; Owner: -
3025
--
3026

    
3027

    
3028

    
3029

    
3030
--
3031
-- Name: stratum_id; Type: DEFAULT; Schema: public; Owner: -
3032
--
3033

    
3034

    
3035

    
3036

    
3037
--
3038
-- Name: taxon_id; Type: DEFAULT; Schema: public; Owner: -
3039
--
3040

    
3041

    
3042

    
3043

    
3044
--
3045
-- Name: taxonalt_id; Type: DEFAULT; Schema: public; Owner: -
3046
--
3047

    
3048

    
3049

    
3050

    
3051
--
3052
-- Name: taxondetermination_id; Type: DEFAULT; Schema: public; Owner: -
3053
--
3054

    
3055

    
3056

    
3057

    
3058
--
3059
-- Name: taxonoccurrence_id; Type: DEFAULT; Schema: public; Owner: -
3060
--
3061

    
3062

    
3063

    
3064

    
3065
--
3066
-- Name: taxonpath_id; Type: DEFAULT; Schema: public; Owner: -
3067
--
3068

    
3069

    
3070

    
3071

    
3072
--
3073
-- Name: taxonscope_id; Type: DEFAULT; Schema: public; Owner: -
3074
--
3075

    
3076

    
3077

    
3078

    
3079
--
3080
-- Name: telephone_id; Type: DEFAULT; Schema: public; Owner: -
3081
--
3082

    
3083

    
3084

    
3085

    
3086
--
3087
-- Name: trait_id; Type: DEFAULT; Schema: public; Owner: -
3088
--
3089

    
3090

    
3091

    
3092

    
3093
--
3094
-- Name: userdefined_id; Type: DEFAULT; Schema: public; Owner: -
3095
--
3096

    
3097

    
3098

    
3099

    
3100
--
3101
-- Name: voucher_id; Type: DEFAULT; Schema: public; Owner: -
3102
--
3103

    
3104

    
3105

    
3106

    
3107
--
3108
-- Name: address_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3109
--
3110

    
3111
ALTER TABLE address
3112
    ADD CONSTRAINT address_pkey PRIMARY KEY (address_id);
3113

    
3114

    
3115
--
3116
-- Name: aggregateoccurrence_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3117
--
3118

    
3119
ALTER TABLE aggregateoccurrence
3120
    ADD CONSTRAINT aggregateoccurrence_pkey PRIMARY KEY (aggregateoccurrence_id);
3121

    
3122

    
3123
--
3124
-- Name: classcontributor_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3125
--
3126

    
3127
ALTER TABLE classcontributor
3128
    ADD CONSTRAINT classcontributor_pkey PRIMARY KEY (classcontributor_id);
3129

    
3130

    
3131
--
3132
-- Name: commclass_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3133
--
3134

    
3135
ALTER TABLE commclass
3136
    ADD CONSTRAINT commclass_pkey PRIMARY KEY (commclass_id);
3137

    
3138

    
3139
--
3140
-- Name: commconcept_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3141
--
3142

    
3143
ALTER TABLE commconcept
3144
    ADD CONSTRAINT commconcept_pkey PRIMARY KEY (commconcept_id);
3145

    
3146

    
3147
--
3148
-- Name: commconcept_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3149
--
3150

    
3151
ALTER TABLE commconcept
3152
    ADD CONSTRAINT commconcept_unique UNIQUE (commname_id);
3153

    
3154

    
3155
--
3156
-- Name: commcorrelation_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3157
--
3158

    
3159
ALTER TABLE commcorrelation
3160
    ADD CONSTRAINT commcorrelation_pkey PRIMARY KEY (commcorrelation_id);
3161

    
3162

    
3163
--
3164
-- Name: commdetermination_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3165
--
3166

    
3167
ALTER TABLE commdetermination
3168
    ADD CONSTRAINT commdetermination_pkey PRIMARY KEY (commdetermination_id);
3169

    
3170

    
3171
--
3172
-- Name: commdetermination_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3173
--
3174

    
3175
ALTER TABLE commdetermination
3176
    ADD CONSTRAINT commdetermination_unique UNIQUE (commclass_id, commconcept_id);
3177

    
3178

    
3179
--
3180
-- Name: commlineage_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3181
--
3182

    
3183
ALTER TABLE commlineage
3184
    ADD CONSTRAINT commlineage_pkey PRIMARY KEY (commlineage_id);
3185

    
3186

    
3187
--
3188
-- Name: commname_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3189
--
3190

    
3191
ALTER TABLE commname
3192
    ADD CONSTRAINT commname_pkey PRIMARY KEY (commname_id);
3193

    
3194

    
3195
--
3196
-- Name: commname_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3197
--
3198

    
3199
ALTER TABLE commname
3200
    ADD CONSTRAINT commname_unique UNIQUE (commname);
3201

    
3202

    
3203
--
3204
-- Name: commstatus_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3205
--
3206

    
3207
ALTER TABLE commstatus
3208
    ADD CONSTRAINT commstatus_pkey PRIMARY KEY (commstatus_id);
3209

    
3210

    
3211
--
3212
-- Name: commusage_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3213
--
3214

    
3215
ALTER TABLE commusage
3216
    ADD CONSTRAINT commusage_pkey PRIMARY KEY (commusage_id);
3217

    
3218

    
3219
--
3220
-- Name: coverindex_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3221
--
3222

    
3223
ALTER TABLE coverindex
3224
    ADD CONSTRAINT coverindex_pkey PRIMARY KEY (coverindex_id);
3225

    
3226

    
3227
--
3228
-- Name: covermethod_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3229
--
3230

    
3231
ALTER TABLE covermethod
3232
    ADD CONSTRAINT covermethod_pkey PRIMARY KEY (covermethod_id);
3233

    
3234

    
3235
--
3236
-- Name: definedvalue_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3237
--
3238

    
3239
ALTER TABLE definedvalue
3240
    ADD CONSTRAINT definedvalue_pkey PRIMARY KEY (definedvalue_id);
3241

    
3242

    
3243
--
3244
-- Name: definedvalue_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3245
--
3246

    
3247
ALTER TABLE definedvalue
3248
    ADD CONSTRAINT definedvalue_unique UNIQUE (userdefined_id, tablerecord_id);
3249

    
3250

    
3251
--
3252
-- Name: disturbanceobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3253
--
3254

    
3255
ALTER TABLE disturbanceobs
3256
    ADD CONSTRAINT disturbanceobs_pkey PRIMARY KEY (disturbanceobs_id);
3257

    
3258

    
3259
--
3260
-- Name: graphic_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3261
--
3262

    
3263
ALTER TABLE graphic
3264
    ADD CONSTRAINT graphic_pkey PRIMARY KEY (graphic_id);
3265

    
3266

    
3267
--
3268
-- Name: location_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3269
--
3270

    
3271
ALTER TABLE location
3272
    ADD CONSTRAINT location_pkey PRIMARY KEY (location_id);
3273

    
3274

    
3275
--
3276
-- Name: locationcoords_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3277
--
3278

    
3279
ALTER TABLE locationcoords
3280
    ADD CONSTRAINT locationcoords_pkey PRIMARY KEY (locationcoords_id);
3281

    
3282

    
3283
--
3284
-- Name: locationevent_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3285
--
3286

    
3287
ALTER TABLE locationevent
3288
    ADD CONSTRAINT locationevent_pkey PRIMARY KEY (locationevent_id);
3289

    
3290

    
3291
--
3292
-- Name: locationeventcontributor_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3293
--
3294

    
3295
ALTER TABLE locationeventcontributor
3296
    ADD CONSTRAINT locationeventcontributor_pkey PRIMARY KEY (locationeventcontributor_id);
3297

    
3298

    
3299
--
3300
-- Name: locationeventsynonym_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3301
--
3302

    
3303
ALTER TABLE locationeventsynonym
3304
    ADD CONSTRAINT locationeventsynonym_pkey PRIMARY KEY (locationeventsynonym_id);
3305

    
3306

    
3307
--
3308
-- Name: locationplace_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3309
--
3310

    
3311
ALTER TABLE locationplace
3312
    ADD CONSTRAINT locationplace_pkey PRIMARY KEY (locationplace_id);
3313

    
3314

    
3315
--
3316
-- Name: method_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3317
--
3318

    
3319
ALTER TABLE method
3320
    ADD CONSTRAINT method_pkey PRIMARY KEY (method_id);
3321

    
3322

    
3323
--
3324
-- Name: methodtaxonclass_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3325
--
3326

    
3327
ALTER TABLE methodtaxonclass
3328
    ADD CONSTRAINT methodtaxonclass_pkey PRIMARY KEY (methodtaxonclass_id);
3329

    
3330

    
3331
--
3332
-- Name: methodtaxonclass_unique_description; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3333
--
3334

    
3335
ALTER TABLE methodtaxonclass
3336
    ADD CONSTRAINT methodtaxonclass_unique_description UNIQUE (method_id, taxonclass);
3337

    
3338

    
3339
--
3340
-- Name: methodtaxonclass_unique_taxonpath_id; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3341
--
3342

    
3343
ALTER TABLE methodtaxonclass
3344
    ADD CONSTRAINT methodtaxonclass_unique_taxonpath_id UNIQUE (method_id, taxonpath_id);
3345

    
3346

    
3347
--
3348
-- Name: note_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3349
--
3350

    
3351
ALTER TABLE note
3352
    ADD CONSTRAINT note_pkey PRIMARY KEY (note_id);
3353

    
3354

    
3355
--
3356
-- Name: notelink_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3357
--
3358

    
3359
ALTER TABLE notelink
3360
    ADD CONSTRAINT notelink_pkey PRIMARY KEY (notelink_id);
3361

    
3362

    
3363
--
3364
-- Name: party_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3365
--
3366

    
3367
ALTER TABLE party
3368
    ADD CONSTRAINT party_pkey PRIMARY KEY (party_id);
3369

    
3370

    
3371
--
3372
-- Name: partymember_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3373
--
3374

    
3375
ALTER TABLE partymember
3376
    ADD CONSTRAINT partymember_pkey PRIMARY KEY (partymember_id);
3377

    
3378

    
3379
--
3380
-- Name: place_ancestor_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3381
--
3382

    
3383
ALTER TABLE place_ancestor
3384
    ADD CONSTRAINT place_ancestor_pkey PRIMARY KEY (place_id, ancestor_id);
3385

    
3386

    
3387
--
3388
-- Name: place_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3389
--
3390

    
3391
ALTER TABLE place
3392
    ADD CONSTRAINT place_pkey PRIMARY KEY (place_id);
3393

    
3394

    
3395
--
3396
-- Name: placecorrelation_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3397
--
3398

    
3399
ALTER TABLE placecorrelation
3400
    ADD CONSTRAINT placecorrelation_pkey PRIMARY KEY (placecorrelation_id);
3401

    
3402

    
3403
--
3404
-- Name: placepath_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3405
--
3406

    
3407
ALTER TABLE placepath
3408
    ADD CONSTRAINT placepath_pkey PRIMARY KEY (placepath_id);
3409

    
3410

    
3411
--
3412
-- Name: placepath_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3413
--
3414

    
3415
ALTER TABLE placepath
3416
    ADD CONSTRAINT placepath_unique UNIQUE (place_id);
3417

    
3418

    
3419
--
3420
-- Name: plant_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3421
--
3422

    
3423
ALTER TABLE plant
3424
    ADD CONSTRAINT plant_pkey PRIMARY KEY (plant_id);
3425

    
3426

    
3427
--
3428
-- Name: plantcorrelation_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3429
--
3430

    
3431
ALTER TABLE plantcorrelation
3432
    ADD CONSTRAINT plantcorrelation_pkey PRIMARY KEY (plantcorrelation_id);
3433

    
3434

    
3435
--
3436
-- Name: plantlineage_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3437
--
3438

    
3439
ALTER TABLE plantlineage
3440
    ADD CONSTRAINT plantlineage_pkey PRIMARY KEY (plantlineage_id);
3441

    
3442

    
3443
--
3444
-- Name: plantobservation_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3445
--
3446

    
3447
ALTER TABLE plantobservation
3448
    ADD CONSTRAINT plantobservation_pkey PRIMARY KEY (plantobservation_id);
3449

    
3450

    
3451
--
3452
-- Name: plantstatus_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3453
--
3454

    
3455
ALTER TABLE plantstatus
3456
    ADD CONSTRAINT plantstatus_pkey PRIMARY KEY (plantstatus_id);
3457

    
3458

    
3459
--
3460
-- Name: plantstatus_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3461
--
3462

    
3463
ALTER TABLE plantstatus
3464
    ADD CONSTRAINT plantstatus_unique UNIQUE (taxonpath_id, party_id);
3465

    
3466

    
3467
--
3468
-- Name: plantusage_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3469
--
3470

    
3471
ALTER TABLE plantusage
3472
    ADD CONSTRAINT plantusage_pkey PRIMARY KEY (plantusage_id);
3473

    
3474

    
3475
--
3476
-- Name: project_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3477
--
3478

    
3479
ALTER TABLE project
3480
    ADD CONSTRAINT project_pkey PRIMARY KEY (project_id);
3481

    
3482

    
3483
--
3484
-- Name: project_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3485
--
3486

    
3487
ALTER TABLE project
3488
    ADD CONSTRAINT project_unique UNIQUE (datasource_id, projectname);
3489

    
3490

    
3491
--
3492
-- Name: projectcontributor_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3493
--
3494

    
3495
ALTER TABLE projectcontributor
3496
    ADD CONSTRAINT projectcontributor_pkey PRIMARY KEY (projectcontributor_id);
3497

    
3498

    
3499
--
3500
-- Name: reference_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3501
--
3502

    
3503
ALTER TABLE reference
3504
    ADD CONSTRAINT reference_pkey PRIMARY KEY (reference_id);
3505

    
3506

    
3507
--
3508
-- Name: referencealtident_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3509
--
3510

    
3511
ALTER TABLE referencealtident
3512
    ADD CONSTRAINT referencealtident_pkey PRIMARY KEY (referencealtident_id);
3513

    
3514

    
3515
--
3516
-- Name: referencecontributor_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3517
--
3518

    
3519
ALTER TABLE referencecontributor
3520
    ADD CONSTRAINT referencecontributor_pkey PRIMARY KEY (referencecontributor_id);
3521

    
3522

    
3523
--
3524
-- Name: referencejournal_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3525
--
3526

    
3527
ALTER TABLE referencejournal
3528
    ADD CONSTRAINT referencejournal_pkey PRIMARY KEY (referencejournal_id);
3529

    
3530

    
3531
--
3532
-- Name: referenceparty_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3533
--
3534

    
3535
ALTER TABLE referenceparty
3536
    ADD CONSTRAINT referenceparty_pkey PRIMARY KEY (referenceparty_id);
3537

    
3538

    
3539
--
3540
-- Name: revision_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3541
--
3542

    
3543
ALTER TABLE revision
3544
    ADD CONSTRAINT revision_pkey PRIMARY KEY (revision_id);
3545

    
3546

    
3547
--
3548
-- Name: soilobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3549
--
3550

    
3551
ALTER TABLE soilobs
3552
    ADD CONSTRAINT soilobs_pkey PRIMARY KEY (soilobs_id);
3553

    
3554

    
3555
--
3556
-- Name: soilobs_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3557
--
3558

    
3559
ALTER TABLE soilobs
3560
    ADD CONSTRAINT soilobs_unique UNIQUE (locationevent_id);
3561

    
3562

    
3563
--
3564
-- Name: soiltaxon_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3565
--
3566

    
3567
ALTER TABLE soiltaxon
3568
    ADD CONSTRAINT soiltaxon_pkey PRIMARY KEY (soiltaxon_id);
3569

    
3570

    
3571
--
3572
-- Name: specimen_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3573
--
3574

    
3575
ALTER TABLE specimen
3576
    ADD CONSTRAINT specimen_pkey PRIMARY KEY (specimen_id);
3577

    
3578

    
3579
--
3580
-- Name: specimenreplicate_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3581
--
3582

    
3583
ALTER TABLE specimenreplicate
3584
    ADD CONSTRAINT specimenreplicate_pkey PRIMARY KEY (specimenreplicate_id);
3585

    
3586

    
3587
--
3588
-- Name: stemobservation_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3589
--
3590

    
3591
ALTER TABLE stemobservation
3592
    ADD CONSTRAINT stemobservation_pkey PRIMARY KEY (stemobservation_id);
3593

    
3594

    
3595
--
3596
-- Name: stratum_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3597
--
3598

    
3599
ALTER TABLE stratum
3600
    ADD CONSTRAINT stratum_pkey PRIMARY KEY (stratum_id);
3601

    
3602

    
3603
--
3604
-- Name: taxon_ancestor_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3605
--
3606

    
3607
ALTER TABLE taxon_ancestor
3608
    ADD CONSTRAINT taxon_ancestor_pkey PRIMARY KEY (taxon_id, ancestor_id);
3609

    
3610

    
3611
--
3612
-- Name: taxon_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3613
--
3614

    
3615
ALTER TABLE taxon
3616
    ADD CONSTRAINT taxon_pkey PRIMARY KEY (taxon_id);
3617

    
3618

    
3619
--
3620
-- Name: taxonalt_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3621
--
3622

    
3623
ALTER TABLE taxonalt
3624
    ADD CONSTRAINT taxonalt_pkey PRIMARY KEY (taxonalt_id);
3625

    
3626

    
3627
--
3628
-- Name: taxondetermination_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3629
--
3630

    
3631
ALTER TABLE taxondetermination
3632
    ADD CONSTRAINT taxondetermination_pkey PRIMARY KEY (taxondetermination_id);
3633

    
3634

    
3635
--
3636
-- Name: taxonoccurrence_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3637
--
3638

    
3639
ALTER TABLE taxonoccurrence
3640
    ADD CONSTRAINT taxonoccurrence_pkey PRIMARY KEY (taxonoccurrence_id);
3641

    
3642

    
3643
--
3644
-- Name: taxonpath_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3645
--
3646

    
3647
ALTER TABLE taxonpath
3648
    ADD CONSTRAINT taxonpath_pkey PRIMARY KEY (taxonpath_id);
3649

    
3650

    
3651
--
3652
-- Name: taxonscope_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3653
--
3654

    
3655
ALTER TABLE taxonscope
3656
    ADD CONSTRAINT taxonscope_pkey PRIMARY KEY (taxonscope_id);
3657

    
3658

    
3659
--
3660
-- Name: telephone_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3661
--
3662

    
3663
ALTER TABLE telephone
3664
    ADD CONSTRAINT telephone_pkey PRIMARY KEY (telephone_id);
3665

    
3666

    
3667
--
3668
-- Name: trait_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3669
--
3670

    
3671
ALTER TABLE trait
3672
    ADD CONSTRAINT trait_pkey PRIMARY KEY (trait_id);
3673

    
3674

    
3675
--
3676
-- Name: userdefined_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3677
--
3678

    
3679
ALTER TABLE userdefined
3680
    ADD CONSTRAINT userdefined_pkey PRIMARY KEY (userdefined_id);
3681

    
3682

    
3683
--
3684
-- Name: userdefined_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3685
--
3686

    
3687
ALTER TABLE userdefined
3688
    ADD CONSTRAINT userdefined_unique UNIQUE (tablename, userdefinedname);
3689

    
3690

    
3691
--
3692
-- Name: voucher_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3693
--
3694

    
3695
ALTER TABLE voucher
3696
    ADD CONSTRAINT voucher_pkey PRIMARY KEY (voucher_id);
3697

    
3698

    
3699
--
3700
-- Name: voucher_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3701
--
3702

    
3703
ALTER TABLE voucher
3704
    ADD CONSTRAINT voucher_unique UNIQUE (taxonoccurrence_id, specimenreplicate_id);
3705

    
3706

    
3707
--
3708
-- Name: aggregateoccurrence_taxonoccurrence; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3709
--
3710

    
3711
CREATE INDEX aggregateoccurrence_taxonoccurrence ON aggregateoccurrence  (taxonoccurrence_id);
3712

    
3713

    
3714
--
3715
-- Name: aggregateoccurrence_taxonoccurrence_1_to_1; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3716
--
3717

    
3718

    
3719

    
3720

    
3721
--
3722
-- Name: aggregateoccurrence_unique_within_datasource; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3723
--
3724

    
3725

    
3726

    
3727

    
3728
--
3729
-- Name: commclass_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3730
--
3731

    
3732
CREATE UNIQUE INDEX commclass_accessioncode_index ON commclass  (accessioncode);
3733

    
3734

    
3735
--
3736
-- Name: commclass_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3737
--
3738

    
3739

    
3740

    
3741

    
3742
--
3743
-- Name: commconcept_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3744
--
3745

    
3746
CREATE UNIQUE INDEX commconcept_accessioncode_index ON commconcept  (accessioncode);
3747

    
3748

    
3749
--
3750
-- Name: commstatus_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3751
--
3752

    
3753
CREATE UNIQUE INDEX commstatus_accessioncode_index ON commstatus  (accessioncode);
3754

    
3755

    
3756
--
3757
-- Name: covermethod_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3758
--
3759

    
3760
CREATE UNIQUE INDEX covermethod_accessioncode_index ON covermethod  (accessioncode);
3761

    
3762

    
3763
--
3764
-- Name: graphic_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3765
--
3766

    
3767
CREATE UNIQUE INDEX graphic_accessioncode_index ON graphic  (accessioncode);
3768

    
3769

    
3770
--
3771
-- Name: location_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3772
--
3773

    
3774
CREATE UNIQUE INDEX location_accessioncode_index ON location  (accessioncode);
3775

    
3776

    
3777
--
3778
-- Name: location_unique_within_datasource_by_authorlocationcode; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3779
--
3780

    
3781

    
3782

    
3783

    
3784
--
3785
-- Name: location_unique_within_datasource_by_sourceaccessioncode; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3786
--
3787

    
3788

    
3789

    
3790

    
3791
--
3792
-- Name: location_unique_within_parent; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3793
--
3794

    
3795

    
3796

    
3797

    
3798
--
3799
-- Name: locationcoords_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3800
--
3801

    
3802

    
3803

    
3804

    
3805
--
3806
-- Name: locationevent_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3807
--
3808

    
3809
CREATE UNIQUE INDEX locationevent_accessioncode_index ON locationevent  (accessioncode);
3810

    
3811

    
3812
--
3813
-- Name: locationevent_location; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3814
--
3815

    
3816
CREATE INDEX locationevent_location ON locationevent  (location_id);
3817

    
3818

    
3819
--
3820
-- Name: locationevent_unique_within_datasource; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3821
--
3822

    
3823

    
3824

    
3825

    
3826
--
3827
-- Name: locationevent_unique_within_location; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3828
--
3829

    
3830

    
3831

    
3832

    
3833
--
3834
-- Name: locationevent_unique_within_parent_by_authoreventcode; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3835
--
3836

    
3837

    
3838

    
3839

    
3840
--
3841
-- Name: locationevent_unique_within_parent_by_location; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3842
--
3843

    
3844

    
3845

    
3846

    
3847
--
3848
-- Name: locationevent_unique_within_project; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3849
--
3850

    
3851

    
3852

    
3853

    
3854
--
3855
-- Name: locationeventsynonym_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3856
--
3857

    
3858
CREATE UNIQUE INDEX locationeventsynonym_accessioncode_index ON locationeventsynonym  (accessioncode);
3859

    
3860

    
3861
--
3862
-- Name: locationplace_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3863
--
3864

    
3865

    
3866

    
3867

    
3868
--
3869
-- Name: method_accessioncode; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3870
--
3871

    
3872
CREATE UNIQUE INDEX method_accessioncode ON method  (accessioncode);
3873

    
3874

    
3875
--
3876
-- Name: method_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3877
--
3878

    
3879

    
3880

    
3881

    
3882
--
3883
-- Name: note_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3884
--
3885

    
3886
CREATE UNIQUE INDEX note_accessioncode_index ON note  (accessioncode);
3887

    
3888

    
3889
--
3890
-- Name: party_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3891
--
3892

    
3893
CREATE UNIQUE INDEX party_accessioncode_index ON party  (accessioncode);
3894

    
3895

    
3896
--
3897
-- Name: party_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3898
--
3899

    
3900

    
3901

    
3902

    
3903
--
3904
-- Name: place_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3905
--
3906

    
3907
CREATE UNIQUE INDEX place_accessioncode_index ON place  (accessioncode);
3908

    
3909

    
3910
--
3911
-- Name: place_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3912
--
3913

    
3914

    
3915

    
3916

    
3917
--
3918
-- Name: placepath_unique_within_datasource_by_code; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3919
--
3920

    
3921

    
3922

    
3923

    
3924
--
3925
-- Name: placepath_unique_within_datasource_by_name; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3926
--
3927

    
3928

    
3929

    
3930

    
3931
--
3932
-- Name: plantobservation_aggregateoccurrence_1_to_1; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3933
--
3934

    
3935
CREATE UNIQUE INDEX plantobservation_aggregateoccurrence_1_to_1 ON plantobservation  (aggregateoccurrence_id);
3936

    
3937

    
3938
--
3939
-- Name: plantobservation_unique_within_datasource; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3940
--
3941

    
3942

    
3943

    
3944

    
3945
--
3946
-- Name: plantstatus_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3947
--
3948

    
3949
CREATE UNIQUE INDEX plantstatus_accessioncode_index ON plantstatus  (accessioncode);
3950

    
3951

    
3952
--
3953
-- Name: project_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3954
--
3955

    
3956
CREATE UNIQUE INDEX project_accessioncode_index ON project  (accessioncode);
3957

    
3958

    
3959
--
3960
-- Name: project_unique_name_date; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3961
--
3962

    
3963

    
3964

    
3965

    
3966
--
3967
-- Name: project_unique_within_datasource; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3968
--
3969

    
3970

    
3971

    
3972

    
3973
--
3974
-- Name: reference_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3975
--
3976

    
3977
CREATE UNIQUE INDEX reference_accessioncode_index ON reference  (accessioncode);
3978

    
3979

    
3980
--
3981
-- Name: referencejournal_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3982
--
3983

    
3984
CREATE UNIQUE INDEX referencejournal_accessioncode_index ON referencejournal  (accessioncode);
3985

    
3986

    
3987
--
3988
-- Name: referenceparty_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3989
--
3990

    
3991
CREATE UNIQUE INDEX referenceparty_accessioncode_index ON referenceparty  (accessioncode);
3992

    
3993

    
3994
--
3995
-- Name: soiltaxon_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3996
--
3997

    
3998
CREATE UNIQUE INDEX soiltaxon_accessioncode_index ON soiltaxon  (accessioncode);
3999

    
4000

    
4001
--
4002
-- Name: specimenreplicate_plantobservation; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4003
--
4004

    
4005
CREATE INDEX specimenreplicate_plantobservation ON specimenreplicate  (plantobservation_id);
4006

    
4007

    
4008
--
4009
-- Name: specimenreplicate_plantobservation_1_to_1; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4010
--
4011

    
4012

    
4013

    
4014

    
4015
--
4016
-- Name: specimenreplicate_unique_catalognumber; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4017
--
4018

    
4019

    
4020

    
4021

    
4022
--
4023
-- Name: specimenreplicate_unique_within_datasource; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4024
--
4025

    
4026

    
4027

    
4028

    
4029
--
4030
-- Name: stemobservation_plantobservation_1_to_1; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4031
--
4032

    
4033

    
4034

    
4035

    
4036
--
4037
-- Name: stemobservation_unique_within_datasource; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4038
--
4039

    
4040

    
4041

    
4042

    
4043
--
4044
-- Name: stemobservation_unique_within_plantobservation; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4045
--
4046

    
4047

    
4048

    
4049

    
4050
--
4051
-- Name: taxon_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4052
--
4053

    
4054

    
4055

    
4056

    
4057
--
4058
-- Name: taxondetermination_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4059
--
4060

    
4061
CREATE UNIQUE INDEX taxondetermination_accessioncode_index ON taxondetermination  (accessioncode);
4062

    
4063

    
4064
--
4065
-- Name: taxondetermination_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4066
--
4067

    
4068

    
4069

    
4070

    
4071
--
4072
-- Name: taxonoccurrence_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4073
--
4074

    
4075
CREATE UNIQUE INDEX taxonoccurrence_accessioncode_index ON taxonoccurrence  (accessioncode);
4076

    
4077

    
4078
--
4079
-- Name: taxonoccurrence_locationevent; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4080
--
4081

    
4082
CREATE INDEX taxonoccurrence_locationevent ON taxonoccurrence  (locationevent_id);
4083

    
4084

    
4085
--
4086
-- Name: taxonoccurrence_unique_within_datasource; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4087
--
4088

    
4089

    
4090

    
4091

    
4092
--
4093
-- Name: taxonoccurrence_unique_within_locationevent; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4094
--
4095

    
4096

    
4097

    
4098

    
4099
--
4100
-- Name: taxonpath_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4101
--
4102

    
4103
CREATE UNIQUE INDEX taxonpath_accessioncode_index ON taxonpath  (accessioncode);
4104

    
4105

    
4106
--
4107
-- Name: taxonpath_unique_within_datasource_by_code; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4108
--
4109

    
4110

    
4111

    
4112

    
4113
--
4114
-- Name: taxonpath_unique_within_datasource_by_name; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4115
--
4116

    
4117

    
4118

    
4119

    
4120
--
4121
-- Name: taxonscope_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4122
--
4123

    
4124

    
4125

    
4126

    
4127
--
4128
-- Name: userdefined_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4129
--
4130

    
4131
CREATE UNIQUE INDEX userdefined_accessioncode_index ON userdefined  (accessioncode);
4132

    
4133

    
4134
--
4135
-- Name: place_update_ancestors; Type: TRIGGER; Schema: public; Owner: -
4136
--
4137

    
4138

    
4139

    
4140

    
4141
--
4142
-- Name: plantobservation_aggregateoccurrence_count_1; Type: TRIGGER; Schema: public; Owner: -
4143
--
4144

    
4145

    
4146

    
4147

    
4148
--
4149
-- Name: taxon_update_ancestors; Type: TRIGGER; Schema: public; Owner: -
4150
--
4151

    
4152

    
4153

    
4154

    
4155
--
4156
-- Name: address_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4157
--
4158

    
4159
ALTER TABLE address
4160
    ADD CONSTRAINT address_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
4161

    
4162

    
4163
--
4164
-- Name: address_party_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4165
--
4166

    
4167
ALTER TABLE address
4168
    ADD CONSTRAINT address_party_id_fkey FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
4169

    
4170

    
4171
--
4172
-- Name: aggregateoccurrence_coverindex_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4173
--
4174

    
4175

    
4176

    
4177

    
4178
--
4179
-- Name: aggregateoccurrence_datasource_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4180
--
4181

    
4182

    
4183

    
4184

    
4185
--
4186
-- Name: aggregateoccurrence_method_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4187
--
4188

    
4189

    
4190

    
4191

    
4192
--
4193
-- Name: aggregateoccurrence_stratum_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4194
--
4195

    
4196
ALTER TABLE aggregateoccurrence
4197
    ADD CONSTRAINT aggregateoccurrence_stratum_id_fkey FOREIGN KEY (stratum_id) REFERENCES stratum(stratum_id) ON UPDATE CASCADE ON DELETE CASCADE;
4198

    
4199

    
4200
--
4201
-- Name: aggregateoccurrence_taxonoccurrence_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4202
--
4203

    
4204
ALTER TABLE aggregateoccurrence
4205
    ADD CONSTRAINT aggregateoccurrence_taxonoccurrence_id_fkey FOREIGN KEY (taxonoccurrence_id) REFERENCES taxonoccurrence(taxonoccurrence_id) ON UPDATE CASCADE ON DELETE CASCADE;
4206

    
4207

    
4208
--
4209
-- Name: classcontributor_commclass_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4210
--
4211

    
4212
ALTER TABLE classcontributor
4213
    ADD CONSTRAINT classcontributor_commclass_id_fkey FOREIGN KEY (commclass_id) REFERENCES commclass(commclass_id) ON UPDATE CASCADE ON DELETE CASCADE;
4214

    
4215

    
4216
--
4217
-- Name: classcontributor_party_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4218
--
4219

    
4220

    
4221

    
4222

    
4223
--
4224
-- Name: commclass_classpublication_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4225
--
4226

    
4227

    
4228

    
4229

    
4230
--
4231
-- Name: commclass_locationevent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4232
--
4233

    
4234

    
4235

    
4236

    
4237
--
4238
-- Name: commconcept_commname_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4239
--
4240

    
4241
ALTER TABLE commconcept
4242
    ADD CONSTRAINT commconcept_commname_id_fkey FOREIGN KEY (commname_id) REFERENCES commname(commname_id) ON UPDATE CASCADE ON DELETE CASCADE;
4243

    
4244

    
4245
--
4246
-- Name: commconcept_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4247
--
4248

    
4249

    
4250

    
4251

    
4252
--
4253
-- Name: commcorrelation_commconcept_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4254
--
4255

    
4256
ALTER TABLE commcorrelation
4257
    ADD CONSTRAINT commcorrelation_commconcept_id_fkey FOREIGN KEY (commconcept_id) REFERENCES commconcept(commconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
4258

    
4259

    
4260
--
4261
-- Name: commcorrelation_commstatus_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4262
--
4263

    
4264
ALTER TABLE commcorrelation
4265
    ADD CONSTRAINT commcorrelation_commstatus_id_fkey FOREIGN KEY (commstatus_id) REFERENCES commstatus(commstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;
4266

    
4267

    
4268
--
4269
-- Name: commdetermination_commauthority_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4270
--
4271

    
4272

    
4273

    
4274

    
4275
--
4276
-- Name: commdetermination_commclass_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4277
--
4278

    
4279
ALTER TABLE commdetermination
4280
    ADD CONSTRAINT commdetermination_commclass_id_fkey FOREIGN KEY (commclass_id) REFERENCES commclass(commclass_id) ON UPDATE CASCADE ON DELETE CASCADE;
4281

    
4282

    
4283
--
4284
-- Name: commdetermination_commconcept_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4285
--
4286

    
4287
ALTER TABLE commdetermination
4288
    ADD CONSTRAINT commdetermination_commconcept_id_fkey FOREIGN KEY (commconcept_id) REFERENCES commconcept(commconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
4289

    
4290

    
4291
--
4292
-- Name: commlineage_childcommstatus_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4293
--
4294

    
4295
ALTER TABLE commlineage
4296
    ADD CONSTRAINT commlineage_childcommstatus_id_fkey FOREIGN KEY (childcommstatus_id) REFERENCES commstatus(commstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;
4297

    
4298

    
4299
--
4300
-- Name: commlineage_parentcommstatus_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4301
--
4302

    
4303
ALTER TABLE commlineage
4304
    ADD CONSTRAINT commlineage_parentcommstatus_id_fkey FOREIGN KEY (parentcommstatus_id) REFERENCES commstatus(commstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;
4305

    
4306

    
4307
--
4308
-- Name: commname_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4309
--
4310

    
4311

    
4312

    
4313

    
4314
--
4315
-- Name: commstatus_commconcept_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4316
--
4317

    
4318
ALTER TABLE commstatus
4319
    ADD CONSTRAINT commstatus_commconcept_id_fkey FOREIGN KEY (commconcept_id) REFERENCES commconcept(commconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
4320

    
4321

    
4322
--
4323
-- Name: commstatus_commparent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4324
--
4325

    
4326
ALTER TABLE commstatus
4327
    ADD CONSTRAINT commstatus_commparent_id_fkey FOREIGN KEY (commparent_id) REFERENCES commconcept(commconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
4328

    
4329

    
4330
--
4331
-- Name: commstatus_party_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4332
--
4333

    
4334

    
4335

    
4336

    
4337
--
4338
-- Name: commstatus_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4339
--
4340

    
4341

    
4342

    
4343

    
4344
--
4345
-- Name: commusage_commconcept_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4346
--
4347

    
4348
ALTER TABLE commusage
4349
    ADD CONSTRAINT commusage_commconcept_id_fkey FOREIGN KEY (commconcept_id) REFERENCES commconcept(commconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
4350

    
4351

    
4352
--
4353
-- Name: commusage_commname_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4354
--
4355

    
4356
ALTER TABLE commusage
4357
    ADD CONSTRAINT commusage_commname_id_fkey FOREIGN KEY (commname_id) REFERENCES commname(commname_id) ON UPDATE CASCADE ON DELETE CASCADE;
4358

    
4359

    
4360
--
4361
-- Name: commusage_commstatus_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4362
--
4363

    
4364
ALTER TABLE commusage
4365
    ADD CONSTRAINT commusage_commstatus_id_fkey FOREIGN KEY (commstatus_id) REFERENCES commstatus(commstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;
4366

    
4367

    
4368
--
4369
-- Name: commusage_party_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4370
--
4371

    
4372

    
4373

    
4374

    
4375
--
4376
-- Name: coverindex_covermethod_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4377
--
4378

    
4379
ALTER TABLE coverindex
4380
    ADD CONSTRAINT coverindex_covermethod_id_fkey FOREIGN KEY (covermethod_id) REFERENCES covermethod(covermethod_id) ON UPDATE CASCADE ON DELETE CASCADE;
4381

    
4382

    
4383
--
4384
-- Name: covermethod_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4385
--
4386

    
4387

    
4388

    
4389

    
4390
--
4391
-- Name: definedvalue_userdefined_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4392
--
4393

    
4394
ALTER TABLE definedvalue
4395
    ADD CONSTRAINT definedvalue_userdefined_id_fkey FOREIGN KEY (userdefined_id) REFERENCES userdefined(userdefined_id) ON UPDATE CASCADE ON DELETE CASCADE;
4396

    
4397

    
4398
--
4399
-- Name: disturbanceobs_locationevent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4400
--
4401

    
4402
ALTER TABLE disturbanceobs
4403
    ADD CONSTRAINT disturbanceobs_locationevent_id_fkey FOREIGN KEY (locationevent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
4404

    
4405

    
4406
--
4407
-- Name: graphic_locationevent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4408
--
4409

    
4410
ALTER TABLE graphic
4411
    ADD CONSTRAINT graphic_locationevent_id_fkey FOREIGN KEY (locationevent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
4412

    
4413

    
4414
--
4415
-- Name: location_datasource_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4416
--
4417

    
4418

    
4419

    
4420

    
4421
--
4422
-- Name: location_parent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4423
--
4424

    
4425
ALTER TABLE location
4426
    ADD CONSTRAINT location_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES location(location_id) ON UPDATE CASCADE ON DELETE CASCADE;
4427

    
4428

    
4429
--
4430
-- Name: locationcoords_identifier_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4431
--
4432

    
4433

    
4434

    
4435

    
4436
--
4437
-- Name: locationcoords_location_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4438
--
4439

    
4440
ALTER TABLE locationcoords
4441
    ADD CONSTRAINT locationcoords_location_id_fkey FOREIGN KEY (location_id) REFERENCES location(location_id) ON UPDATE CASCADE ON DELETE CASCADE;
4442

    
4443

    
4444
--
4445
-- Name: locationevent_datasource_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4446
--
4447

    
4448

    
4449

    
4450

    
4451
--
4452
-- Name: locationevent_location_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4453
--
4454

    
4455
ALTER TABLE locationevent
4456
    ADD CONSTRAINT locationevent_location_id_fkey FOREIGN KEY (location_id) REFERENCES location(location_id) ON UPDATE CASCADE ON DELETE CASCADE;
4457

    
4458

    
4459
--
4460
-- Name: locationevent_method_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4461
--
4462

    
4463

    
4464

    
4465

    
4466
--
4467
-- Name: locationevent_parent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4468
--
4469

    
4470
ALTER TABLE locationevent
4471
    ADD CONSTRAINT locationevent_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
4472

    
4473

    
4474
--
4475
-- Name: locationevent_previous_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4476
--
4477

    
4478
ALTER TABLE locationevent
4479
    ADD CONSTRAINT locationevent_previous_id_fkey FOREIGN KEY (previous_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
4480

    
4481

    
4482
--
4483
-- Name: locationevent_project_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4484
--
4485

    
4486
ALTER TABLE locationevent
4487
    ADD CONSTRAINT locationevent_project_id_fkey FOREIGN KEY (project_id) REFERENCES project(project_id) ON UPDATE CASCADE ON DELETE CASCADE;
4488

    
4489

    
4490
--
4491
-- Name: locationevent_soiltaxon_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4492
--
4493

    
4494
ALTER TABLE locationevent
4495
    ADD CONSTRAINT locationevent_soiltaxon_id_fkey FOREIGN KEY (soiltaxon_id) REFERENCES soiltaxon(soiltaxon_id) ON UPDATE CASCADE ON DELETE CASCADE;
4496

    
4497

    
4498
--
4499
-- Name: locationeventcontributor_locationevent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4500
--
4501

    
4502
ALTER TABLE locationeventcontributor
4503
    ADD CONSTRAINT locationeventcontributor_locationevent_id_fkey FOREIGN KEY (locationevent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
4504

    
4505

    
4506
--
4507
-- Name: locationeventcontributor_party_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4508
--
4509

    
4510

    
4511

    
4512

    
4513
--
4514
-- Name: locationeventsynonym_party_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4515
--
4516

    
4517

    
4518

    
4519

    
4520
--
4521
-- Name: locationeventsynonym_primarylocationevent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4522
--
4523

    
4524
ALTER TABLE locationeventsynonym
4525
    ADD CONSTRAINT locationeventsynonym_primarylocationevent_id_fkey FOREIGN KEY (primarylocationevent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
4526

    
4527

    
4528
--
4529
-- Name: locationeventsynonym_synonymlocationevent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4530
--
4531

    
4532
ALTER TABLE locationeventsynonym
4533
    ADD CONSTRAINT locationeventsynonym_synonymlocationevent_id_fkey FOREIGN KEY (synonymlocationevent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
4534

    
4535

    
4536
--
4537
-- Name: locationplace_identifier_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4538
--
4539

    
4540

    
4541

    
4542

    
4543
--
4544
-- Name: locationplace_location_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4545
--
4546

    
4547
ALTER TABLE locationplace
4548
    ADD CONSTRAINT locationplace_location_id_fkey FOREIGN KEY (location_id) REFERENCES location(location_id) ON UPDATE CASCADE ON DELETE CASCADE;
4549

    
4550

    
4551
--
4552
-- Name: locationplace_placepath_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4553
--
4554

    
4555
ALTER TABLE locationplace
4556
    ADD CONSTRAINT locationplace_placepath_id_fkey FOREIGN KEY (placepath_id) REFERENCES placepath(placepath_id) ON UPDATE CASCADE ON DELETE CASCADE;
4557

    
4558

    
4559
--
4560
-- Name: method_covermethod_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4561
--
4562

    
4563
ALTER TABLE method
4564
    ADD CONSTRAINT method_covermethod_id_fkey FOREIGN KEY (covermethod_id) REFERENCES covermethod(covermethod_id) ON UPDATE CASCADE ON DELETE CASCADE;
4565

    
4566

    
4567
--
4568
-- Name: method_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4569
--
4570

    
4571

    
4572

    
4573

    
4574
--
4575
-- Name: method_subplotmethod_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4576
--
4577

    
4578
ALTER TABLE method
4579
    ADD CONSTRAINT method_subplotmethod_id_fkey FOREIGN KEY (subplotmethod_id) REFERENCES method(method_id) ON UPDATE CASCADE ON DELETE SET NULL;
4580

    
4581

    
4582
--
4583
-- Name: methodtaxonclass_method_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4584
--
4585

    
4586
ALTER TABLE methodtaxonclass
4587
    ADD CONSTRAINT methodtaxonclass_method_id_fkey FOREIGN KEY (method_id) REFERENCES method(method_id) ON UPDATE CASCADE ON DELETE CASCADE;
4588

    
4589

    
4590
--
4591
-- Name: methodtaxonclass_submethod_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4592
--
4593

    
4594
ALTER TABLE methodtaxonclass
4595
    ADD CONSTRAINT methodtaxonclass_submethod_id_fkey FOREIGN KEY (submethod_id) REFERENCES method(method_id) ON UPDATE CASCADE ON DELETE SET NULL;
4596

    
4597

    
4598
--
4599
-- Name: methodtaxonclass_taxonpath_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4600
--
4601

    
4602
ALTER TABLE methodtaxonclass
4603
    ADD CONSTRAINT methodtaxonclass_taxonpath_id_fkey FOREIGN KEY (taxonpath_id) REFERENCES taxonpath(taxonpath_id) ON UPDATE CASCADE ON DELETE CASCADE;
4604

    
4605

    
4606
--
4607
-- Name: note_notelink_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4608
--
4609

    
4610
ALTER TABLE note
4611
    ADD CONSTRAINT note_notelink_id_fkey FOREIGN KEY (notelink_id) REFERENCES notelink(notelink_id) ON UPDATE CASCADE ON DELETE CASCADE;
4612

    
4613

    
4614
--
4615
-- Name: note_party_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4616
--
4617

    
4618

    
4619

    
4620

    
4621
--
4622
-- Name: party_currentname_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4623
--
4624

    
4625
ALTER TABLE party
4626
    ADD CONSTRAINT party_currentname_id_fkey FOREIGN KEY (currentname_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
4627

    
4628

    
4629
--
4630
-- Name: partymember_childparty_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4631
--
4632

    
4633
ALTER TABLE partymember
4634
    ADD CONSTRAINT partymember_childparty_id_fkey FOREIGN KEY (childparty_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
4635

    
4636

    
4637
--
4638
-- Name: partymember_parentparty_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4639
--
4640

    
4641
ALTER TABLE partymember
4642
    ADD CONSTRAINT partymember_parentparty_id_fkey FOREIGN KEY (parentparty_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
4643

    
4644

    
4645
--
4646
-- Name: place_ancestor_ancestor_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4647
--
4648

    
4649
ALTER TABLE place_ancestor
4650
    ADD CONSTRAINT place_ancestor_ancestor_id_fkey FOREIGN KEY (ancestor_id) REFERENCES place(place_id) ON UPDATE CASCADE ON DELETE CASCADE;
4651

    
4652

    
4653
--
4654
-- Name: place_ancestor_place_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4655
--
4656

    
4657
ALTER TABLE place_ancestor
4658
    ADD CONSTRAINT place_ancestor_place_id_fkey FOREIGN KEY (place_id) REFERENCES place(place_id) ON UPDATE CASCADE ON DELETE CASCADE;
4659

    
4660

    
4661
--
4662
-- Name: place_parent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4663
--
4664

    
4665
ALTER TABLE place
4666
    ADD CONSTRAINT place_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES place(place_id) ON UPDATE CASCADE ON DELETE CASCADE;
4667

    
4668

    
4669
--
4670
-- Name: placecorrelation_childplace_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4671
--
4672

    
4673
ALTER TABLE placecorrelation
4674
    ADD CONSTRAINT placecorrelation_childplace_id_fkey FOREIGN KEY (childplace_id) REFERENCES place(place_id) ON UPDATE CASCADE ON DELETE CASCADE;
4675

    
4676

    
4677
--
4678
-- Name: placecorrelation_parentplace_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4679
--
4680

    
4681
ALTER TABLE placecorrelation
4682
    ADD CONSTRAINT placecorrelation_parentplace_id_fkey FOREIGN KEY (parentplace_id) REFERENCES place(place_id) ON UPDATE CASCADE ON DELETE CASCADE;
4683

    
4684

    
4685
--
4686
-- Name: placepath_datasource_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4687
--
4688

    
4689

    
4690

    
4691

    
4692
--
4693
-- Name: placepath_place_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4694
--
4695

    
4696
ALTER TABLE placepath
4697
    ADD CONSTRAINT placepath_place_id_fkey FOREIGN KEY (place_id) REFERENCES place(place_id) ON UPDATE CASCADE ON DELETE CASCADE;
4698

    
4699

    
4700
--
4701
-- Name: plantcorrelation_plantstatus_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4702
--
4703

    
4704
ALTER TABLE plantcorrelation
4705
    ADD CONSTRAINT plantcorrelation_plantstatus_id_fkey FOREIGN KEY (plantstatus_id) REFERENCES plantstatus(plantstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;
4706

    
4707

    
4708
--
4709
-- Name: plantcorrelation_taxonpath_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4710
--
4711

    
4712

    
4713

    
4714

    
4715
--
4716
-- Name: plantlineage_childplantstatus_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4717
--
4718

    
4719
ALTER TABLE plantlineage
4720
    ADD CONSTRAINT plantlineage_childplantstatus_id_fkey FOREIGN KEY (childplantstatus_id) REFERENCES plantstatus(plantstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;
4721

    
4722

    
4723
--
4724
-- Name: plantlineage_parentplantstatus_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4725
--
4726

    
4727
ALTER TABLE plantlineage
4728
    ADD CONSTRAINT plantlineage_parentplantstatus_id_fkey FOREIGN KEY (parentplantstatus_id) REFERENCES plantstatus(plantstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;
4729

    
4730

    
4731
--
4732
-- Name: plantobservation_aggregateoccurrence_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4733
--
4734

    
4735
ALTER TABLE plantobservation
4736
    ADD CONSTRAINT plantobservation_aggregateoccurrence_id_fkey FOREIGN KEY (aggregateoccurrence_id) REFERENCES aggregateoccurrence(aggregateoccurrence_id) ON UPDATE CASCADE ON DELETE CASCADE;
4737

    
4738

    
4739
--
4740
-- Name: plantobservation_datasource_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4741
--
4742

    
4743

    
4744

    
4745

    
4746
--
4747
-- Name: plantobservation_plant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4748
--
4749

    
4750
ALTER TABLE plantobservation
4751
    ADD CONSTRAINT plantobservation_plant_id_fkey FOREIGN KEY (plant_id) REFERENCES plant(plant_id) ON UPDATE CASCADE ON DELETE CASCADE;
4752

    
4753

    
4754
--
4755
-- Name: plantstatus_party_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4756
--
4757

    
4758

    
4759

    
4760

    
4761
--
4762
-- Name: plantstatus_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4763
--
4764

    
4765

    
4766

    
4767

    
4768
--
4769
-- Name: plantstatus_taxonpath_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4770
--
4771

    
4772

    
4773

    
4774

    
4775
--
4776
-- Name: plantusage_party_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4777
--
4778

    
4779

    
4780

    
4781

    
4782
--
4783
-- Name: plantusage_plantstatus_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4784
--
4785

    
4786
ALTER TABLE plantusage
4787
    ADD CONSTRAINT plantusage_plantstatus_id_fkey FOREIGN KEY (plantstatus_id) REFERENCES plantstatus(plantstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;
4788

    
4789

    
4790
--
4791
-- Name: plantusage_taxon_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4792
--
4793

    
4794
ALTER TABLE plantusage
4795
    ADD CONSTRAINT plantusage_taxon_id_fkey FOREIGN KEY (taxon_id) REFERENCES taxon(taxon_id) ON UPDATE CASCADE ON DELETE CASCADE;
4796

    
4797

    
4798
--
4799
-- Name: plantusage_taxonpath_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4800
--
4801

    
4802

    
4803

    
4804

    
4805
--
4806
-- Name: project_datasource_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4807
--
4808

    
4809

    
4810

    
4811

    
4812
--
4813
-- Name: projectcontributor_party_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4814
--
4815

    
4816

    
4817

    
4818

    
4819
--
4820
-- Name: projectcontributor_project_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4821
--
4822

    
4823
ALTER TABLE projectcontributor
4824
    ADD CONSTRAINT projectcontributor_project_id_fkey FOREIGN KEY (project_id) REFERENCES project(project_id) ON UPDATE CASCADE ON DELETE CASCADE;
4825

    
4826

    
4827
--
4828
-- Name: reference_referencejournal_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4829
--
4830

    
4831
ALTER TABLE reference
4832
    ADD CONSTRAINT reference_referencejournal_id_fkey FOREIGN KEY (referencejournal_id) REFERENCES referencejournal(referencejournal_id) ON UPDATE CASCADE ON DELETE CASCADE;
4833

    
4834

    
4835
--
4836
-- Name: referencealtident_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4837
--
4838

    
4839
ALTER TABLE referencealtident
4840
    ADD CONSTRAINT referencealtident_reference_id_fkey FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
4841

    
4842

    
4843
--
4844
-- Name: referencecontributor_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4845
--
4846

    
4847
ALTER TABLE referencecontributor
4848
    ADD CONSTRAINT referencecontributor_reference_id_fkey FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
4849

    
4850

    
4851
--
4852
-- Name: referencecontributor_referenceparty_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4853
--
4854

    
4855
ALTER TABLE referencecontributor
4856
    ADD CONSTRAINT referencecontributor_referenceparty_id_fkey FOREIGN KEY (referenceparty_id) REFERENCES referenceparty(referenceparty_id) ON UPDATE CASCADE ON DELETE CASCADE;
4857

    
4858

    
4859
--
4860
-- Name: referenceparty_currentparty_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4861
--
4862

    
4863
ALTER TABLE referenceparty
4864
    ADD CONSTRAINT referenceparty_currentparty_id_fkey FOREIGN KEY (currentparty_id) REFERENCES referenceparty(referenceparty_id) ON UPDATE CASCADE ON DELETE CASCADE;
4865

    
4866

    
4867
--
4868
-- Name: revision_previousrevision_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4869
--
4870

    
4871
ALTER TABLE revision
4872
    ADD CONSTRAINT revision_previousrevision_id_fkey FOREIGN KEY (previousrevision_id) REFERENCES revision(revision_id) ON UPDATE CASCADE ON DELETE CASCADE;
4873

    
4874

    
4875
--
4876
-- Name: soilobs_locationevent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4877
--
4878

    
4879
ALTER TABLE soilobs
4880
    ADD CONSTRAINT soilobs_locationevent_id_fkey FOREIGN KEY (locationevent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
4881

    
4882

    
4883
--
4884
-- Name: soiltaxon_soilparent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4885
--
4886

    
4887
ALTER TABLE soiltaxon
4888
    ADD CONSTRAINT soiltaxon_soilparent_id_fkey FOREIGN KEY (soilparent_id) REFERENCES soiltaxon(soiltaxon_id) ON UPDATE CASCADE ON DELETE CASCADE;
4889

    
4890

    
4891
--
4892
-- Name: specimenreplicate_datasource_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4893
--
4894

    
4895

    
4896

    
4897

    
4898
--
4899
-- Name: specimenreplicate_institution_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4900
--
4901

    
4902

    
4903

    
4904

    
4905
--
4906
-- Name: specimenreplicate_plantobservation_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4907
--
4908

    
4909
ALTER TABLE specimenreplicate
4910
    ADD CONSTRAINT specimenreplicate_plantobservation_id_fkey FOREIGN KEY (plantobservation_id) REFERENCES plantobservation(plantobservation_id) ON UPDATE CASCADE ON DELETE CASCADE;
4911

    
4912

    
4913
--
4914
-- Name: specimenreplicate_specimen_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4915
--
4916

    
4917
ALTER TABLE specimenreplicate
4918
    ADD CONSTRAINT specimenreplicate_specimen_id_fkey FOREIGN KEY (specimen_id) REFERENCES specimen(specimen_id) ON UPDATE CASCADE ON DELETE CASCADE;
4919

    
4920

    
4921
--
4922
-- Name: stemobservation_datasource_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4923
--
4924

    
4925

    
4926

    
4927

    
4928
--
4929
-- Name: stemobservation_plantobservation_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4930
--
4931

    
4932
ALTER TABLE stemobservation
4933
    ADD CONSTRAINT stemobservation_plantobservation_id_fkey FOREIGN KEY (plantobservation_id) REFERENCES plantobservation(plantobservation_id) ON UPDATE CASCADE ON DELETE CASCADE;
4934

    
4935

    
4936
--
4937
-- Name: stratum_locationevent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4938
--
4939

    
4940
ALTER TABLE stratum
4941
    ADD CONSTRAINT stratum_locationevent_id_fkey FOREIGN KEY (locationevent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
4942

    
4943

    
4944
--
4945
-- Name: stratum_method_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4946
--
4947

    
4948

    
4949

    
4950

    
4951
--
4952
-- Name: taxon_ancestor_ancestor_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4953
--
4954

    
4955
ALTER TABLE taxon_ancestor
4956
    ADD CONSTRAINT taxon_ancestor_ancestor_id_fkey FOREIGN KEY (ancestor_id) REFERENCES taxon(taxon_id) ON UPDATE CASCADE ON DELETE CASCADE;
4957

    
4958

    
4959
--
4960
-- Name: taxon_ancestor_taxon_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4961
--
4962

    
4963
ALTER TABLE taxon_ancestor
4964
    ADD CONSTRAINT taxon_ancestor_taxon_id_fkey FOREIGN KEY (taxon_id) REFERENCES taxon(taxon_id) ON UPDATE CASCADE ON DELETE CASCADE;
4965

    
4966

    
4967
--
4968
-- Name: taxon_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4969
--
4970

    
4971

    
4972

    
4973

    
4974
--
4975
-- Name: taxon_authority_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4976
--
4977

    
4978

    
4979

    
4980

    
4981
--
4982
-- Name: taxon_parent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4983
--
4984

    
4985
ALTER TABLE taxon
4986
    ADD CONSTRAINT taxon_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES taxon(taxon_id) ON UPDATE CASCADE ON DELETE CASCADE;
4987

    
4988

    
4989
--
4990
-- Name: taxonalt_taxondetermination_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4991
--
4992

    
4993
ALTER TABLE taxonalt
4994
    ADD CONSTRAINT taxonalt_taxondetermination_id_fkey FOREIGN KEY (taxondetermination_id) REFERENCES taxondetermination(taxondetermination_id) ON UPDATE CASCADE ON DELETE CASCADE;
4995

    
4996

    
4997
--
4998
-- Name: taxonalt_taxonpath_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4999
--
5000

    
5001
ALTER TABLE taxonalt
5002
    ADD CONSTRAINT taxonalt_taxonpath_id_fkey FOREIGN KEY (taxonpath_id) REFERENCES taxonpath(taxonpath_id) ON UPDATE CASCADE ON DELETE CASCADE;
5003

    
5004

    
5005
--
5006
-- Name: taxondetermination_party_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5007
--
5008

    
5009

    
5010

    
5011

    
5012
--
5013
-- Name: taxondetermination_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5014
--
5015

    
5016

    
5017

    
5018

    
5019
--
5020
-- Name: taxondetermination_taxonoccurrence_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5021
--
5022

    
5023
ALTER TABLE taxondetermination
5024
    ADD CONSTRAINT taxondetermination_taxonoccurrence_id_fkey FOREIGN KEY (taxonoccurrence_id) REFERENCES taxonoccurrence(taxonoccurrence_id) ON UPDATE CASCADE ON DELETE CASCADE;
5025

    
5026

    
5027
--
5028
-- Name: taxondetermination_taxonpath_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5029
--
5030

    
5031
ALTER TABLE taxondetermination
5032
    ADD CONSTRAINT taxondetermination_taxonpath_id_fkey FOREIGN KEY (taxonpath_id) REFERENCES taxonpath(taxonpath_id) ON UPDATE CASCADE ON DELETE CASCADE;
5033

    
5034

    
5035
--
5036
-- Name: taxonoccurrence_datasource_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5037
--
5038

    
5039

    
5040

    
5041

    
5042
--
5043
-- Name: taxonoccurrence_locationevent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5044
--
5045

    
5046
ALTER TABLE taxonoccurrence
5047
    ADD CONSTRAINT taxonoccurrence_locationevent_id_fkey FOREIGN KEY (locationevent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
5048

    
5049

    
5050
--
5051
-- Name: taxonpath_canon_taxonpath_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5052
--
5053

    
5054
ALTER TABLE taxonpath
5055
    ADD CONSTRAINT taxonpath_canon_taxonpath_id_fkey FOREIGN KEY (canon_taxonpath_id) REFERENCES taxonpath(taxonpath_id) ON UPDATE CASCADE ON DELETE CASCADE;
5056

    
5057

    
5058
--
5059
-- Name: taxonpath_datasource_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5060
--
5061

    
5062

    
5063

    
5064

    
5065
--
5066
-- Name: taxonpath_scope_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5067
--
5068

    
5069
ALTER TABLE taxonpath
5070
    ADD CONSTRAINT taxonpath_scope_id_fkey FOREIGN KEY (scope_id) REFERENCES taxonscope(taxonscope_id) ON UPDATE CASCADE ON DELETE CASCADE;
5071

    
5072

    
5073
--
5074
-- Name: taxonpath_taxon_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5075
--
5076

    
5077
ALTER TABLE taxonpath
5078
    ADD CONSTRAINT taxonpath_taxon_id_fkey FOREIGN KEY (taxon_id) REFERENCES taxon(taxon_id) ON UPDATE CASCADE ON DELETE CASCADE;
5079

    
5080

    
5081
--
5082
-- Name: taxonscope_locationevent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5083
--
5084

    
5085

    
5086

    
5087

    
5088
--
5089
-- Name: taxonscope_place_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5090
--
5091

    
5092

    
5093

    
5094

    
5095
--
5096
-- Name: taxonscope_project_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5097
--
5098

    
5099

    
5100

    
5101

    
5102
--
5103
-- Name: telephone_party_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5104
--
5105

    
5106
ALTER TABLE telephone
5107
    ADD CONSTRAINT telephone_party_id_fkey FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
5108

    
5109

    
5110
--
5111
-- Name: trait_stemobservation_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5112
--
5113

    
5114
ALTER TABLE trait
5115
    ADD CONSTRAINT trait_stemobservation_id_fkey FOREIGN KEY (stemobservation_id) REFERENCES stemobservation(stemobservation_id) ON UPDATE CASCADE ON DELETE CASCADE;
5116

    
5117

    
5118
--
5119
-- Name: voucher_specimenreplicate_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5120
--
5121

    
5122
ALTER TABLE voucher
5123
    ADD CONSTRAINT voucher_specimenreplicate_id_fkey FOREIGN KEY (specimenreplicate_id) REFERENCES specimenreplicate(specimenreplicate_id) ON UPDATE CASCADE ON DELETE CASCADE;
5124

    
5125

    
5126
--
5127
-- Name: voucher_taxonoccurrence_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5128
--
5129

    
5130
ALTER TABLE voucher
5131
    ADD CONSTRAINT voucher_taxonoccurrence_id_fkey FOREIGN KEY (taxonoccurrence_id) REFERENCES taxonoccurrence(taxonoccurrence_id) ON UPDATE CASCADE ON DELETE CASCADE;
5132

    
5133

    
5134
--
5135
-- PostgreSQL database dump complete
5136
--
5137

    
(19-19/20)