Revision 3958
Added by Aaron Marcuse-Kubitza over 12 years ago
vegbien.sql | ||
---|---|---|
4357 | 4357 |
-- Name: specimenreplicate_plantobservation_1_to_1; Type: INDEX; Schema: public; Owner: -; Tablespace: |
4358 | 4358 |
-- |
4359 | 4359 |
|
4360 |
CREATE UNIQUE INDEX specimenreplicate_plantobservation_1_to_1 ON specimenreplicate USING btree ((COALESCE(plantobservation_id, 2147483647))) WHERE (plantobservation_id IS NOT NULL);
|
|
4360 |
CREATE UNIQUE INDEX specimenreplicate_plantobservation_1_to_1 ON specimenreplicate USING btree ((COALESCE(plantobservation_id, 2147483647))) WHERE (((plantobservation_id IS NOT NULL) AND (sourceaccessioncode IS NULL)) AND (catalognumber_dwc IS NULL));
|
|
4361 | 4361 |
|
4362 | 4362 |
|
4363 | 4363 |
-- |
4364 | 4364 |
-- Name: specimenreplicate_unique_catalognumber; Type: INDEX; Schema: public; Owner: -; Tablespace: |
4365 | 4365 |
-- |
4366 | 4366 |
|
4367 |
CREATE UNIQUE INDEX specimenreplicate_unique_catalognumber ON specimenreplicate USING btree (datasource_id, (COALESCE(institution_id, 2147483647)), (COALESCE(collectioncode_dwc, '\\N'::text)), (COALESCE(catalognumber_dwc, '\\N'::text))) WHERE ((catalognumber_dwc IS NOT NULL) AND (sourceaccessioncode IS NULL)); |
|
4367 |
CREATE UNIQUE INDEX specimenreplicate_unique_catalognumber ON specimenreplicate USING btree (datasource_id, (COALESCE(institution_id, 2147483647)), (COALESCE(collectioncode_dwc, '\\N'::text)), (COALESCE(catalognumber_dwc, '\\N'::text)), (COALESCE(plantobservation_id, 2147483647))) WHERE ((catalognumber_dwc IS NOT NULL) AND (sourceaccessioncode IS NULL));
|
|
4368 | 4368 |
|
4369 | 4369 |
|
4370 | 4370 |
-- |
Also available in: Unified diff
schemas/vegbien.sql: specimenreplicate: specimenreplicate_plantobservation_1_to_1: Only apply when sourceaccessioncode and catalognumber_dwc are NULL, in order to support multiple specimenreplicates for one plant in plots data. specimenreplicate_unique_catalognumber: Added plantobservation_id, so that catalognumber_dwc (a sort of authorSpecimenCode for plots data) only needs to be unique within a plant. Eventually, we will want to migrate the mappings so that collectionnumber is used for this purpose instead.