Project

General

Profile

« Previous | Next » 

Revision 659

vegbien.sql: Changed individualplant UNIQUE constraint to enforce 1:1 relationship between aggregateoccurrence and individualplant

View differences:

schemas/vegbien.for_ERD.my.sql
250 250
  CONSTRAINT individualplant_aggregateoccurrence_id FOREIGN KEY (aggregateoccurrence_id)
251 251
      REFERENCES aggregateoccurrence (aggregateoccurrence_id) MATCH SIMPLE
252 252
      ON UPDATE CASCADE ON DELETE CASCADE,
253
  CONSTRAINT individualplant_keys_accessioncode UNIQUE (aggregateoccurrence_id , sourceaccessioncode ),
254
  CONSTRAINT individualplant_keys_code UNIQUE (aggregateoccurrence_id , authorplantcode )
253
  CONSTRAINT individualplant_keys UNIQUE (aggregateoccurrence_id )
255 254
);
256 255

  
257 256
CREATE TABLE stem -- VegBank's stemlocation table.
schemas/vegbien.for_ERD.sql
250 250
  CONSTRAINT individualplant_aggregateoccurrence_id FOREIGN KEY (aggregateoccurrence_id)
251 251
      REFERENCES aggregateoccurrence (aggregateoccurrence_id) MATCH SIMPLE
252 252
      ON UPDATE CASCADE ON DELETE CASCADE,
253
  CONSTRAINT individualplant_keys_accessioncode UNIQUE (aggregateoccurrence_id , sourceaccessioncode ),
254
  CONSTRAINT individualplant_keys_code UNIQUE (aggregateoccurrence_id , authorplantcode )
253
  CONSTRAINT individualplant_keys UNIQUE (aggregateoccurrence_id )
255 254
);
256 255

  
257 256
CREATE TABLE stem -- VegBank's stemlocation table.
schemas/vegbien.sql
4050 4050

  
4051 4051

  
4052 4052
--
4053
-- Name: individualplant_keys_accessioncode; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4053
-- Name: individualplant_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4054 4054
--
4055 4055

  
4056 4056
ALTER TABLE ONLY individualplant
4057
    ADD CONSTRAINT individualplant_keys_accessioncode UNIQUE (aggregateoccurrence_id, sourceaccessioncode);
4057
    ADD CONSTRAINT individualplant_keys UNIQUE (aggregateoccurrence_id);
4058 4058

  
4059 4059

  
4060 4060
--
4061
-- Name: individualplant_keys_code; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4062
--
4063

  
4064
ALTER TABLE ONLY individualplant
4065
    ADD CONSTRAINT individualplant_keys_code UNIQUE (aggregateoccurrence_id, authorplantcode);
4066

  
4067

  
4068
--
4069 4061
-- Name: individualplant_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4070 4062
--
4071 4063

  

Also available in: Unified diff