-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
206 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 2 additions & 11 deletions
13
modules/cache_builder/db/version_0_1_2/201504071219_cache_taxon_searchterms_external_key.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,4 @@ | ||
-- #slow script# | ||
-- Took 27 minutes on testwarehouse. | ||
|
||
ALTER TABLE cache_taxon_searchterms | ||
ALTER TABLE cache_taxon_searchterms | ||
ADD COLUMN external_key character varying; | ||
COMMENT ON COLUMN cache_taxon_searchterms.external_key | ||
IS 'External identifier for the taxon.'; | ||
|
||
UPDATE cache_taxon_searchterms cts | ||
SET external_key = cttl.external_key | ||
FROM cache_taxa_taxon_lists cttl | ||
WHERE cttl.id=cts.taxa_taxon_list_id | ||
AND cttl.external_key IS NOT NULL; | ||
IS 'External identifier for the taxon.'; |
7 changes: 7 additions & 0 deletions
7
...cache_builder/db/version_0_1_2/201504071220_cache_taxon_searchterms_external_key_data.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- #slow script# | ||
|
||
UPDATE cache_taxon_searchterms cts | ||
SET external_key = cttl.external_key | ||
FROM cache_taxa_taxon_lists cttl | ||
WHERE cttl.id=cts.taxa_taxon_list_id | ||
AND cttl.external_key IS NOT NULL; |
1 change: 0 additions & 1 deletion
1
modules/cache_builder/db/version_0_1_2/201504211044_cache_occurrences_record_substatus.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 1 addition & 7 deletions
8
modules/cache_builder/db/version_0_1_2/201512131953_occurrences_family_filter.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
-- #slow script# | ||
-- Adds family_taxa_taxon_list_id to cache_occurrences since it makes a big improvement to filtering | ||
ALTER TABLE cache_occurrences | ||
ADD family_taxa_taxon_list_id integer NULL; | ||
|
||
UPDATE cache_occurrences o | ||
SET family_taxa_taxon_list_id=cttl.family_taxa_taxon_list_id | ||
FROM cache_taxa_taxon_lists cttl | ||
WHERE cttl.id=o.taxa_taxon_list_id; | ||
ADD family_taxa_taxon_list_id integer NULL; |
6 changes: 6 additions & 0 deletions
6
modules/cache_builder/db/version_0_1_2/201512131954_occurrences_family_filter_data.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
-- #slow script# | ||
|
||
UPDATE cache_occurrences o | ||
SET family_taxa_taxon_list_id=cttl.family_taxa_taxon_list_id | ||
FROM cache_taxa_taxon_lists cttl | ||
WHERE cttl.id=o.taxa_taxon_list_id; |
1 change: 0 additions & 1 deletion
1
modules/cache_builder/db/version_1_0_0/201512300956_cache_occurrences_view.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 1 addition & 9 deletions
10
modules/cache_builder/db/version_1_28_0/201703171025_confidential.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,2 @@ | ||
-- #slow script# | ||
|
||
ALTER TABLE cache_occurrences_functional | ||
ADD COLUMN confidential BOOLEAN DEFAULT FALSE; | ||
|
||
UPDATE cache_occurrences_functional co | ||
SET confidential=true | ||
FROM occurrences o | ||
WHERE o.id=co.id | ||
AND o.confidential=true; | ||
ADD COLUMN confidential BOOLEAN DEFAULT FALSE; |
7 changes: 7 additions & 0 deletions
7
modules/cache_builder/db/version_1_28_0/201703171026_confidential_data.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- #slow script# | ||
|
||
UPDATE cache_occurrences_functional co | ||
SET confidential=true | ||
FROM occurrences o | ||
WHERE o.id=co.id | ||
AND o.confidential=true; |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...les/indicia_setup/db/version_0_9_1/201504210946_occurrence_record_status_updates_data.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
-- #slow script# | ||
UPDATE occurrence_comments SET query=FALSE; | ||
|
||
UPDATE occurrence_comments oc | ||
SET query=true | ||
FROM occurrences o | ||
WHERE (oc.comment LIKE 'I emailed this record%' OR oc.comment LIKE 'Query%') | ||
AND oc.occurrence_id=o.id | ||
AND o.record_status IN ('S', 'C', 'D'); | ||
|
||
-- Sent status is no longer valid. We track queries via comments instead. | ||
UPDATE occurrences SET record_status='C' where record_status='S'; | ||
|
||
ALTER TABLE occurrences DROP CONSTRAINT occurrences_record_status_check; | ||
|
||
ALTER TABLE occurrences | ||
ADD CONSTRAINT occurrences_record_status_check CHECK (record_status = ANY (ARRAY['I'::bpchar, 'C'::bpchar, 'V'::bpchar, 'R'::bpchar, 'T'::bpchar, 'D'::bpchar])); |
27 changes: 27 additions & 0 deletions
27
modules/indicia_setup/db/version_3_3_0/202001210925_sample_delete.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
CREATE OR REPLACE FUNCTION cascade_sample_delete() RETURNS TRIGGER AS $$ | ||
BEGIN | ||
IF (OLD.deleted = false AND NEW.deleted = true) THEN | ||
UPDATE occurrences | ||
SET deleted = true, updated_on=now(), updated_by_id=new.updated_by_id | ||
WHERE sample_id = OLD.id; | ||
|
||
UPDATE sample_attribute_values | ||
SET deleted = true, updated_on=now(), updated_by_id=new.updated_by_id | ||
WHERE sample_id = OLD.id; | ||
|
||
UPDATE sample_comments | ||
SET deleted = true, updated_on=now(), updated_by_id=new.updated_by_id | ||
WHERE sample_id = OLD.id; | ||
|
||
UPDATE sample_media | ||
SET deleted = true, updated_on=now(), updated_by_id=new.updated_by_id | ||
WHERE sample_id = OLD.id; | ||
|
||
UPDATE samples | ||
SET deleted = true, updated_on=now(), updated_by_id=new.updated_by_id | ||
WHERE parent_id = OLD.id; | ||
|
||
END IF; | ||
RETURN OLD; | ||
END; | ||
$$ LANGUAGE 'plpgsql'; |
3 changes: 3 additions & 0 deletions
3
modules/indicia_setup/db/version_3_3_0/20200224_es_sensitivity_index.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
-- Improves performance when extracting sensitive data to move to Elasticsearch. | ||
CREATE INDEX IF NOT EXISTS ix_cache_occ_functional_id_tracking_sens | ||
ON cache_occurrences_functional(id, tracking) WHERE sensitive=true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.