Project

General

Profile

« Previous | Next » 

Revision 3740

schemas/vegbien.sql: stemobservation: Replaced stemobservation_unique_code unique constraint with stemobservation_unique_within_plantobservation unique index that uses COALESCE and WHERE ... IS NOT NULL appropriately, to work with sql_gen's use of COALESCE indexes and (for the renaming) to better reflect what it does

View differences:

schemas/vegbien.my.sql
3449 3449

  
3450 3450

  
3451 3451
--
3452
-- Name: stemobservation_unique_code; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3453
--
3454

  
3455
ALTER TABLE stemobservation
3456
    ADD CONSTRAINT stemobservation_unique_code UNIQUE (plantobservation_id, authorstemcode);
3457

  
3458

  
3459
--
3460 3452
-- Name: stemtag_current_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3461 3453
--
3462 3454

  
......
3851 3843

  
3852 3844

  
3853 3845
--
3846
-- Name: stemobservation_unique_within_plantobservation; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3847
--
3848

  
3849

  
3850

  
3851

  
3852
--
3854 3853
-- Name: taxondetermination_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3855 3854
--
3856 3855

  
schemas/vegbien.sql
3998 3998

  
3999 3999

  
4000 4000
--
4001
-- Name: stemobservation_unique_code; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4002
--
4003

  
4004
ALTER TABLE ONLY stemobservation
4005
    ADD CONSTRAINT stemobservation_unique_code UNIQUE (plantobservation_id, authorstemcode);
4006

  
4007

  
4008
--
4009 4001
-- Name: stemtag_current_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4010 4002
--
4011 4003

  
......
4397 4389

  
4398 4390

  
4399 4391
--
4392
-- Name: stemobservation_unique_within_plantobservation; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4393
--
4394

  
4395
CREATE UNIQUE INDEX stemobservation_unique_within_plantobservation ON stemobservation USING btree (plantobservation_id, (COALESCE(authorstemcode, '\\N'::text))) WHERE (authorstemcode IS NOT NULL);
4396

  
4397

  
4398
--
4400 4399
-- Name: taxondetermination_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4401 4400
--
4402 4401

  

Also available in: Unified diff