Project

General

Profile

« Previous | Next » 

Revision 3997

schemas/vegbien.sql: location: location_unique_within_datasource unique index: Added COALESCE and `WHERE sourceaccessioncode IS NOT NULL` now that sourceaccessioncode is nullable. Renamed location_unique_within_datasource and location_unique_authorlocationcode to location_unique_within_datasource_by_... to show that both are alternatives for globally unique keys. schemas/vegbien.ERD.mwb: Moved elements slightly to reduce the number of lines that need to be repositioned after syncing with the schema.

View differences:

schemas/vegbien.my.sql
3627 3627

  
3628 3628

  
3629 3629
--
3630
-- Name: location_unique_authorlocationcode; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3630
-- Name: location_unique_within_datasource_by_authorlocationcode; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3631 3631
--
3632 3632

  
3633 3633

  
3634 3634

  
3635 3635

  
3636 3636
--
3637
-- Name: location_unique_within_datasource; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3637
-- Name: location_unique_within_datasource_by_sourceaccessioncode; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3638 3638
--
3639 3639

  
3640
CREATE UNIQUE INDEX location_unique_within_datasource ON location  (datasource_id, sourceaccessioncode);
3641 3640

  
3642 3641

  
3642

  
3643 3643
--
3644 3644
-- Name: location_unique_within_parent; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3645 3645
--
schemas/vegbien.sql
4159 4159

  
4160 4160

  
4161 4161
--
4162
-- Name: location_unique_authorlocationcode; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4162
-- Name: location_unique_within_datasource_by_authorlocationcode; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4163 4163
--
4164 4164

  
4165
CREATE UNIQUE INDEX location_unique_authorlocationcode ON location USING btree (datasource_id, (COALESCE(authorlocationcode, '\\N'::text))) WHERE ((authorlocationcode IS NOT NULL) AND (sourceaccessioncode IS NULL));
4165
CREATE UNIQUE INDEX location_unique_within_datasource_by_authorlocationcode ON location USING btree (datasource_id, (COALESCE(authorlocationcode, '\\N'::text))) WHERE ((authorlocationcode IS NOT NULL) AND (sourceaccessioncode IS NULL));
4166 4166

  
4167 4167

  
4168 4168
--
4169
-- Name: location_unique_within_datasource; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4169
-- Name: location_unique_within_datasource_by_sourceaccessioncode; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4170 4170
--
4171 4171

  
4172
CREATE UNIQUE INDEX location_unique_within_datasource ON location USING btree (datasource_id, sourceaccessioncode);
4172
CREATE UNIQUE INDEX location_unique_within_datasource_by_sourceaccessioncode ON location USING btree (datasource_id, (COALESCE(sourceaccessioncode, '\\N'::text))) WHERE (sourceaccessioncode IS NOT NULL);
4173 4173

  
4174 4174

  
4175 4175
--

Also available in: Unified diff