Project

General

Profile

« Previous | Next » 

Revision 469

vegbien.sql: Added UNIQUE constraints to tables used in the mapping so that duplicates are eliminated by the database

View differences:

schemas/vegbien.sql
3639 3639

  
3640 3640

  
3641 3641
--
3642
-- Name: collectiveobservation_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3643
--
3644

  
3645
ALTER TABLE ONLY collectiveobservation
3646
    ADD CONSTRAINT collectiveobservation_keys UNIQUE (taxonoccurrence_id, taxonbin_id);
3647

  
3648

  
3649
--
3642 3650
-- Name: collectiveobservation_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3643 3651
--
3644 3652

  
......
3647 3655

  
3648 3656

  
3649 3657
--
3658
-- Name: commclass_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3659
--
3660

  
3661
ALTER TABLE ONLY commclass
3662
    ADD CONSTRAINT commclass_keys UNIQUE (plotevent_id, classnotes);
3663

  
3664

  
3665
--
3650 3666
-- Name: commclass_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3651 3667
--
3652 3668

  
......
3655 3671

  
3656 3672

  
3657 3673
--
3674
-- Name: commconcept_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3675
--
3676

  
3677
ALTER TABLE ONLY commconcept
3678
    ADD CONSTRAINT commconcept_keys UNIQUE (commname_id);
3679

  
3680

  
3681
--
3658 3682
-- Name: commconcept_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3659 3683
--
3660 3684

  
......
3671 3695

  
3672 3696

  
3673 3697
--
3698
-- Name: commdetermination_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3699
--
3700

  
3701
ALTER TABLE ONLY commdetermination
3702
    ADD CONSTRAINT commdetermination_keys UNIQUE (commclass_id, commconcept_id);
3703

  
3704

  
3705
--
3674 3706
-- Name: commdetermination_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3675 3707
--
3676 3708

  
......
3687 3719

  
3688 3720

  
3689 3721
--
3722
-- Name: commname_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3723
--
3724

  
3725
ALTER TABLE ONLY commname
3726
    ADD CONSTRAINT commname_keys UNIQUE (commname);
3727

  
3728

  
3729
--
3690 3730
-- Name: commname_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3691 3731
--
3692 3732

  
......
3847 3887

  
3848 3888

  
3849 3889
--
3890
-- Name: individualplant_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3891
--
3892

  
3893
ALTER TABLE ONLY individualplant
3894
    ADD CONSTRAINT individualplant_keys UNIQUE (collectiveobservation_id, code);
3895

  
3896

  
3897
--
3850 3898
-- Name: individualplant_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3851 3899
--
3852 3900

  
......
3855 3903

  
3856 3904

  
3857 3905
--
3906
-- Name: namedplace_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3907
--
3908

  
3909
ALTER TABLE ONLY namedplace
3910
    ADD CONSTRAINT namedplace_keys UNIQUE (placesystem, placename);
3911

  
3912

  
3913
--
3858 3914
-- Name: namedplace_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3859 3915
--
3860 3916

  
......
3887 3943

  
3888 3944

  
3889 3945
--
3946
-- Name: party_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3947
--
3948

  
3949
ALTER TABLE ONLY party
3950
    ADD CONSTRAINT party_keys UNIQUE (givenname, middlename, surname, organizationname);
3951

  
3952

  
3953
--
3890 3954
-- Name: party_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3891 3955
--
3892 3956

  
......
3903 3967

  
3904 3968

  
3905 3969
--
3970
-- Name: place_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3971
--
3972

  
3973
ALTER TABLE ONLY place
3974
    ADD CONSTRAINT place_keys UNIQUE (plot_id, namedplace_id);
3975

  
3976

  
3977
--
3906 3978
-- Name: place_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3907 3979
--
3908 3980

  
......
3959 4031

  
3960 4032

  
3961 4033
--
4034
-- Name: plot_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4035
--
4036

  
4037
ALTER TABLE ONLY plot
4038
    ADD CONSTRAINT plot_keys UNIQUE (reference_id, parent_id, authorcode);
4039

  
4040

  
4041
--
3962 4042
-- Name: plot_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3963 4043
--
3964 4044

  
......
3967 4047

  
3968 4048

  
3969 4049
--
4050
-- Name: plotevent_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4051
--
4052

  
4053
ALTER TABLE ONLY plotevent
4054
    ADD CONSTRAINT plotevent_keys UNIQUE (plot_id, project_id, authorcode);
4055

  
4056

  
4057
--
3970 4058
-- Name: plotevent_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3971 4059
--
3972 4060

  
......
3991 4079

  
3992 4080

  
3993 4081
--
4082
-- Name: project_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4083
--
4084

  
4085
ALTER TABLE ONLY project
4086
    ADD CONSTRAINT project_keys UNIQUE (projectname, startdate, stopdate);
4087

  
4088

  
4089
--
3994 4090
-- Name: project_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3995 4091
--
3996 4092

  
......
4055 4151

  
4056 4152

  
4057 4153
--
4154
-- Name: soilobs_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4155
--
4156

  
4157
ALTER TABLE ONLY soilobs
4158
    ADD CONSTRAINT soilobs_keys UNIQUE (plotevent_id);
4159

  
4160

  
4161
--
4058 4162
-- Name: soilobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4059 4163
--
4060 4164

  
......
4071 4175

  
4072 4176

  
4073 4177
--
4178
-- Name: stemobservation_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4179
--
4180

  
4181
ALTER TABLE ONLY stemobservation
4182
    ADD CONSTRAINT stemobservation_keys UNIQUE (individualplant_id, stemcode);
4183

  
4184

  
4185
--
4074 4186
-- Name: stemobservation_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4075 4187
--
4076 4188

  
......
4119 4231

  
4120 4232

  
4121 4233
--
4234
-- Name: taxondetermination_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4235
--
4236

  
4237
ALTER TABLE ONLY taxondetermination
4238
    ADD CONSTRAINT taxondetermination_keys UNIQUE (taxonoccurrence_id, stemobservation_id, role_id, plantname_id, museumaccessionnumber);
4239

  
4240

  
4241
--
4122 4242
-- Name: taxondetermination_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4123 4243
--
4124 4244

  

Also available in: Unified diff