Project

General

Profile

« Previous | Next » 

Revision 3222

schemas/vegbien.sql: specimenreplicate: Fixing specimenreplicate->taxonoccurrence mapping bug where taxonoccurrence_id is no longer used as an fkey because it's instead a pkey inherited from taxonoccurrence, by instead adding an fkey to plantobservation for direct vouchers. Also, it makes more sense for a specimenreplicate to directly voucher the plant it came from rather than that plant's taxonoccurrence, because a direct voucher is a closer relationship to the plant.

View differences:

schemas/vegbien.my.sql
2176 2176
CREATE TABLE specimenreplicate (
2177 2177
    taxonoccurrence_id int(11) NOT NULL AUTO_INCREMENT,
2178 2178
    datasource_id int(11) NOT NULL,
2179
    plantobservation_id int(11),
2180
    sourceaccessioncode text,
2181
    institution_id int(11),
2179 2182
    collectioncode_dwc text,
2180 2183
    catalognumber_dwc text,
2184
    collectionnumber text,
2181 2185
    collectiondate timestamp NULL,
2182
    institution_id int(11),
2183
    sourceaccessioncode text,
2184
    collectionnumber text,
2185
    specimen_id int(11),
2186
    description text
2186
    description text,
2187
    specimen_id int(11)
2187 2188
)
2188 2189
;
2189 2190
ALTER TABLE specimenreplicate
......
2199 2200

  
2200 2201

  
2201 2202
--
2202
-- Name: COLUMN specimenreplicate.collectioncode_dwc; Type: COMMENT; Schema: public; Owner: -
2203
-- Name: COLUMN specimenreplicate.institution_id; Type: COMMENT; Schema: public; Owner: -
2203 2204
--
2204 2205

  
2205 2206

  
2206 2207

  
2207 2208

  
2208 2209
--
2209
-- Name: COLUMN specimenreplicate.institution_id; Type: COMMENT; Schema: public; Owner: -
2210
-- Name: COLUMN specimenreplicate.collectioncode_dwc; Type: COMMENT; Schema: public; Owner: -
2210 2211
--
2211 2212

  
2212 2213

  
......
4063 4064

  
4064 4065

  
4065 4066
--
4067
-- Name: fki_specimenreplicate_plantobservation_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4068
--
4069

  
4070
CREATE INDEX fki_specimenreplicate_plantobservation_id ON specimenreplicate  (plantobservation_id);
4071

  
4072

  
4073
--
4066 4074
-- Name: fki_specimenreplicate_reference_id_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4067 4075
--
4068 4076

  
......
5617 5625

  
5618 5626

  
5619 5627
--
5628
-- Name: specimenreplicate_plantobservation_id; Type: FK CONSTRAINT; Schema: public; Owner: -
5629
--
5630

  
5631
ALTER TABLE specimenreplicate
5632
    ADD CONSTRAINT specimenreplicate_plantobservation_id FOREIGN KEY (plantobservation_id) REFERENCES plantobservation(plantobservation_id) ON UPDATE CASCADE ON DELETE CASCADE;
5633

  
5634

  
5635
--
5620 5636
-- Name: specimenreplicate_specimen_id; Type: FK CONSTRAINT; Schema: public; Owner: -
5621 5637
--
5622 5638

  
schemas/vegbien.sql
2668 2668

  
2669 2669
CREATE TABLE specimenreplicate (
2670 2670
    datasource_id integer NOT NULL,
2671
    plantobservation_id integer,
2672
    sourceaccessioncode text,
2673
    institution_id integer,
2671 2674
    collectioncode_dwc text,
2672 2675
    catalognumber_dwc text,
2676
    collectionnumber text,
2673 2677
    collectiondate timestamp with time zone,
2674
    institution_id integer,
2675
    sourceaccessioncode text,
2676
    collectionnumber text,
2677
    specimen_id integer,
2678
    description text
2678
    description text,
2679
    specimen_id integer
2679 2680
)
2680 2681
INHERITS (taxonoccurrence);
2681 2682

  
......
2688 2689

  
2689 2690

  
2690 2691
--
2691
-- Name: COLUMN specimenreplicate.collectioncode_dwc; Type: COMMENT; Schema: public; Owner: -
2692
-- Name: COLUMN specimenreplicate.institution_id; Type: COMMENT; Schema: public; Owner: -
2692 2693
--
2693 2694

  
2694
COMMENT ON COLUMN specimenreplicate.collectioncode_dwc IS 'The code for the collection that the specimenreplicate is from.';
2695
COMMENT ON COLUMN specimenreplicate.institution_id IS 'The the institution (such as a museum) that the specimenreplicate is from.';
2695 2696

  
2696 2697

  
2697 2698
--
2698
-- Name: COLUMN specimenreplicate.institution_id; Type: COMMENT; Schema: public; Owner: -
2699
-- Name: COLUMN specimenreplicate.collectioncode_dwc; Type: COMMENT; Schema: public; Owner: -
2699 2700
--
2700 2701

  
2701
COMMENT ON COLUMN specimenreplicate.institution_id IS 'The the institution (such as a museum) that the specimenreplicate is from.';
2702
COMMENT ON COLUMN specimenreplicate.collectioncode_dwc IS 'The code for the collection that the specimenreplicate is from.';
2702 2703

  
2703 2704

  
2704 2705
--
......
4594 4595

  
4595 4596

  
4596 4597
--
4598
-- Name: fki_specimenreplicate_plantobservation_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4599
--
4600

  
4601
CREATE INDEX fki_specimenreplicate_plantobservation_id ON specimenreplicate USING btree (plantobservation_id);
4602

  
4603

  
4604
--
4597 4605
-- Name: fki_specimenreplicate_reference_id_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4598 4606
--
4599 4607

  
......
6171 6179

  
6172 6180

  
6173 6181
--
6182
-- Name: specimenreplicate_plantobservation_id; Type: FK CONSTRAINT; Schema: public; Owner: -
6183
--
6184

  
6185
ALTER TABLE ONLY specimenreplicate
6186
    ADD CONSTRAINT specimenreplicate_plantobservation_id FOREIGN KEY (plantobservation_id) REFERENCES plantobservation(plantobservation_id) ON UPDATE CASCADE ON DELETE CASCADE;
6187

  
6188

  
6189
--
6174 6190
-- Name: specimenreplicate_specimen_id; Type: FK CONSTRAINT; Schema: public; Owner: -
6175 6191
--
6176 6192

  

Also available in: Unified diff