Project

General

Profile

« Previous | Next » 

Revision 7017

schemas/vegbien.sql: location: location_unique_within_parent: Split into *_by_sourceaccessioncode and *_by_authorlocationcode_position, with each ID being matched separately. This way, if the initial import of a subplot's location provides both fields, but fkey references use only one field, the fkey references will still match the existing location because only one of the fields needs to match.

View differences:

schemas/vegbien.my.sql
5114 5114

  
5115 5115

  
5116 5116
--
5117
-- Name: location_unique_within_parent; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5117
-- Name: location_unique_within_parent_by_authorlocationcode_position; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5118 5118
--
5119 5119

  
5120 5120

  
5121 5121

  
5122 5122

  
5123 5123
--
5124
-- Name: location_unique_within_parent_by_sourceaccessioncode; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5125
--
5126

  
5127

  
5128

  
5129

  
5130
--
5124 5131
-- Name: locationevent_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5125 5132
--
5126 5133

  
schemas/vegbien.sql
6227 6227

  
6228 6228

  
6229 6229
--
6230
-- Name: location_unique_within_parent; Type: INDEX; Schema: public; Owner: -; Tablespace: 
6230
-- Name: location_unique_within_parent_by_authorlocationcode_position; Type: INDEX; Schema: public; Owner: -; Tablespace: 
6231 6231
--
6232 6232

  
6233
CREATE UNIQUE INDEX location_unique_within_parent ON location USING btree ((COALESCE(parent_id, 2147483647)), (COALESCE(sourceaccessioncode, '\N'::text)), (COALESCE(authorlocationcode, '\N'::text)), (COALESCE(sublocationxposition_m, 'NaN'::double precision)), (COALESCE(sublocationyposition_m, 'NaN'::double precision))) WHERE (parent_id IS NOT NULL);
6233
CREATE UNIQUE INDEX location_unique_within_parent_by_authorlocationcode_position ON location USING btree ((COALESCE(parent_id, 2147483647)), (COALESCE(authorlocationcode, '\N'::text)), (COALESCE(sublocationxposition_m, 'NaN'::double precision)), (COALESCE(sublocationyposition_m, 'NaN'::double precision))) WHERE ((parent_id IS NOT NULL) AND (authorlocationcode IS NOT NULL));
6234 6234

  
6235 6235

  
6236 6236
--
6237
-- Name: location_unique_within_parent_by_sourceaccessioncode; Type: INDEX; Schema: public; Owner: -; Tablespace: 
6238
--
6239

  
6240
CREATE UNIQUE INDEX location_unique_within_parent_by_sourceaccessioncode ON location USING btree ((COALESCE(parent_id, 2147483647)), (COALESCE(sourceaccessioncode, '\N'::text))) WHERE ((parent_id IS NOT NULL) AND (sourceaccessioncode IS NOT NULL));
6241

  
6242

  
6243
--
6237 6244
-- Name: locationevent_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
6238 6245
--
6239 6246

  

Also available in: Unified diff