Project

General

Profile

« Previous | Next » 

Revision 660

vegbien.sql: Enforce 1:1 relationship between aggregateoccurrence<->individualplant and taxonoccurrence<->specimen

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 UNIQUE (aggregateoccurrence_id )
253
  CONSTRAINT individualplant_aggregateoccurrence_id_1_to_1 UNIQUE (aggregateoccurrence_id )
254 254
);
255 255

  
256 256
CREATE TABLE stem -- VegBank's stemlocation table.
......
302 302
      ON UPDATE CASCADE ON DELETE CASCADE,
303 303
  CONSTRAINT specimen_keys_accessioncode UNIQUE (reference_id , collectioncode_dwc , sourceaccessioncode ),
304 304
  CONSTRAINT specimen_keys_catalognumber UNIQUE (reference_id , collectioncode_dwc , catalognumber_dwc ),
305
  CONSTRAINT specimen_keys_collectionnumber UNIQUE (reference_id , collectioncode_dwc , collectionnumber )
305
  CONSTRAINT specimen_keys_collectionnumber UNIQUE (reference_id , collectioncode_dwc , collectionnumber ),
306
  CONSTRAINT specimen_taxonoccurrence_id_1_to_1 UNIQUE (taxonoccurrence_id )
306 307
);
307 308

  
308 309
CREATE TABLE voucher
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 UNIQUE (aggregateoccurrence_id )
253
  CONSTRAINT individualplant_aggregateoccurrence_id_1_to_1 UNIQUE (aggregateoccurrence_id )
254 254
);
255 255

  
256 256
CREATE TABLE stem -- VegBank's stemlocation table.
......
302 302
      ON UPDATE CASCADE ON DELETE CASCADE,
303 303
  CONSTRAINT specimen_keys_accessioncode UNIQUE (reference_id , collectioncode_dwc , sourceaccessioncode ),
304 304
  CONSTRAINT specimen_keys_catalognumber UNIQUE (reference_id , collectioncode_dwc , catalognumber_dwc ),
305
  CONSTRAINT specimen_keys_collectionnumber UNIQUE (reference_id , collectioncode_dwc , collectionnumber )
305
  CONSTRAINT specimen_keys_collectionnumber UNIQUE (reference_id , collectioncode_dwc , collectionnumber ),
306
  CONSTRAINT specimen_taxonoccurrence_id_1_to_1 UNIQUE (taxonoccurrence_id )
306 307
);
307 308

  
308 309
CREATE TABLE voucher
schemas/vegbien.sql
4050 4050

  
4051 4051

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

  
4056 4056
ALTER TABLE ONLY individualplant
4057
    ADD CONSTRAINT individualplant_keys UNIQUE (aggregateoccurrence_id);
4057
    ADD CONSTRAINT individualplant_aggregateoccurrence_id_1_to_1 UNIQUE (aggregateoccurrence_id);
4058 4058

  
4059 4059

  
4060 4060
--
......
4418 4418

  
4419 4419

  
4420 4420
--
4421
-- Name: specimen_taxonoccurrence_id_1_to_1; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4422
--
4423

  
4424
ALTER TABLE ONLY specimen
4425
    ADD CONSTRAINT specimen_taxonoccurrence_id_1_to_1 UNIQUE (taxonoccurrence_id);
4426

  
4427

  
4428
--
4421 4429
-- Name: stem_keys_accessioncode; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4422 4430
--
4423 4431

  

Also available in: Unified diff