Project

General

Profile

« Previous | Next » 

Revision 555

vegbien.sql: Removed taxonoccurrence.currentdetermination_id and originaldetermination_id because it's not possible to create a two-way pointer when the child-to-parent pointer is required (chicken-and-egg problem)

View differences:

schemas/vegbien.for_ERD.my.sql
168 168
  emb_taxonoccurrence int(11),
169 169
  -- ...
170 170
  accessioncode character varying(255),
171
  currentdetermination_id int(11),
172
  originaldetermination_id int(11),
173 171
  CONSTRAINT taxonoccurrence_pkey PRIMARY KEY (taxonoccurrence_id ),
174
  CONSTRAINT taxonoccurrence_currentdetermination_id FOREIGN KEY (currentdetermination_id)
175
      REFERENCES taxondetermination (taxondetermination_id) MATCH SIMPLE
176
      ON UPDATE CASCADE ON DELETE CASCADE,
177 172
  CONSTRAINT taxonoccurrence_locationevent_id FOREIGN KEY (locationevent_id)
178 173
      REFERENCES locationevent (locationevent_id) MATCH SIMPLE
179 174
      ON UPDATE CASCADE ON DELETE CASCADE,
180
  CONSTRAINT taxonoccurrence_originaldetermination_id FOREIGN KEY (originaldetermination_id)
181
      REFERENCES taxondetermination (taxondetermination_id) MATCH SIMPLE
182
      ON UPDATE CASCADE ON DELETE CASCADE,
183 175
  CONSTRAINT taxonoccurrence_reference_id FOREIGN KEY (reference_id)
184 176
      REFERENCES reference (reference_id) MATCH SIMPLE
185 177
      ON UPDATE CASCADE ON DELETE CASCADE
schemas/vegbien.for_wiki.sql
39 39
  emb_taxonoccurrence integer,
40 40
  -- ...
41 41
  accessioncode character varying(255),
42
  currentdetermination_id integer,
43
  originaldetermination_id integer,
44 42
);
45 43

  
46 44
CREATE TABLE aggregateoccurrence -- VegBank's taxonimportance table.
schemas/vegbien.for_ERD.sql
168 168
  emb_taxonoccurrence integer,
169 169
  -- ...
170 170
  accessioncode character varying(255),
171
  currentdetermination_id integer,
172
  originaldetermination_id integer,
173 171
  CONSTRAINT taxonoccurrence_pkey PRIMARY KEY (taxonoccurrence_id ),
174
  CONSTRAINT taxonoccurrence_currentdetermination_id FOREIGN KEY (currentdetermination_id)
175
      REFERENCES taxondetermination (taxondetermination_id) MATCH SIMPLE
176
      ON UPDATE CASCADE ON DELETE CASCADE,
177 172
  CONSTRAINT taxonoccurrence_locationevent_id FOREIGN KEY (locationevent_id)
178 173
      REFERENCES locationevent (locationevent_id) MATCH SIMPLE
179 174
      ON UPDATE CASCADE ON DELETE CASCADE,
180
  CONSTRAINT taxonoccurrence_originaldetermination_id FOREIGN KEY (originaldetermination_id)
181
      REFERENCES taxondetermination (taxondetermination_id) MATCH SIMPLE
182
      ON UPDATE CASCADE ON DELETE CASCADE,
183 175
  CONSTRAINT taxonoccurrence_reference_id FOREIGN KEY (reference_id)
184 176
      REFERENCES reference (reference_id) MATCH SIMPLE
185 177
      ON UPDATE CASCADE ON DELETE CASCADE
schemas/vegbien.sql
9 9
SET client_min_messages = warning;
10 10
SET escape_string_warning = off;
11 11

  
12
--
13
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: -
14
--
15

  
16
CREATE OR REPLACE PROCEDURAL LANGUAGE plpgsql;
17

  
18

  
12 19
SET search_path = public, pg_catalog;
13 20

  
14 21
--
......
2574 2581
    int_currplantscinamenoauth character varying(255),
2575 2582
    int_currplantcommon character varying(255),
2576 2583
    int_currplantcode character varying(255),
2577
    accessioncode character varying(255),
2578
    currentdetermination_id integer,
2579
    originaldetermination_id integer
2584
    accessioncode character varying(255)
2580 2585
);
2581 2586

  
2582 2587

  
......
4978 4983

  
4979 4984

  
4980 4985
--
4981
-- Name: fki_taxonoccurrence_currentdetermination_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4982
--
4983

  
4984
CREATE INDEX fki_taxonoccurrence_currentdetermination_id ON taxonoccurrence USING btree (currentdetermination_id);
4985

  
4986

  
4987
--
4988 4986
-- Name: graphic_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4989 4987
--
4990 4988

  
......
6603 6601

  
6604 6602

  
6605 6603
--
6606
-- Name: taxonoccurrence_currentdetermination_id; Type: FK CONSTRAINT; Schema: public; Owner: -
6607
--
6608

  
6609
ALTER TABLE ONLY taxonoccurrence
6610
    ADD CONSTRAINT taxonoccurrence_currentdetermination_id FOREIGN KEY (currentdetermination_id) REFERENCES taxondetermination(taxondetermination_id) ON UPDATE CASCADE ON DELETE CASCADE;
6611

  
6612

  
6613
--
6614 6604
-- Name: taxonoccurrence_locationevent_id; Type: FK CONSTRAINT; Schema: public; Owner: -
6615 6605
--
6616 6606

  
......
6619 6609

  
6620 6610

  
6621 6611
--
6622
-- Name: taxonoccurrence_originaldetermination_id; Type: FK CONSTRAINT; Schema: public; Owner: -
6623
--
6624

  
6625
ALTER TABLE ONLY taxonoccurrence
6626
    ADD CONSTRAINT taxonoccurrence_originaldetermination_id FOREIGN KEY (originaldetermination_id) REFERENCES taxondetermination(taxondetermination_id) ON UPDATE CASCADE ON DELETE CASCADE;
6627

  
6628

  
6629
--
6630 6612
-- Name: taxonoccurrence_reference_id; Type: FK CONSTRAINT; Schema: public; Owner: -
6631 6613
--
6632 6614

  

Also available in: Unified diff