-
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.
Merge remote-tracking branch 'origin/release-1.9.0'
- Loading branch information
Showing
15 changed files
with
433 additions
and
15 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
2 changes: 1 addition & 1 deletion
2
app/serializers/species/autocomplete_taxon_concept_serializer.rb
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
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
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
15 changes: 15 additions & 0 deletions
15
db/migrate/20220808124523_add_author_year_to_autocomplete_view.rb
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,15 @@ | ||
class AddAuthorYearToAutocompleteView < ActiveRecord::Migration | ||
def up | ||
execute "DROP VIEW IF EXISTS auto_complete_taxon_concepts_view" | ||
execute "CREATE VIEW auto_complete_taxon_concepts_view AS #{view_sql('20220808123526', 'auto_complete_taxon_concepts_view')}" | ||
execute File.read(File.expand_path('../../mviews/011_rebuild_auto_complete_taxon_concepts_mview.sql', __FILE__)) | ||
execute "SELECT * FROM rebuild_auto_complete_taxon_concepts_mview()" | ||
end | ||
|
||
def down | ||
execute "DROP VIEW IF EXISTS auto_complete_taxon_concepts_view" | ||
execute "CREATE VIEW auto_complete_taxon_concepts_view AS #{view_sql('20150318150923', 'auto_complete_taxon_concepts_view')}" | ||
execute File.read(File.expand_path('../../mviews/011_rebuild_auto_complete_taxon_concepts_mview.sql', __FILE__)) | ||
execute "SELECT * FROM rebuild_auto_complete_taxon_concepts_mview()" | ||
end | ||
end |
33 changes: 33 additions & 0 deletions
33
db/mviews/011_rebuild_auto_complete_taxon_concepts_mview.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,33 @@ | ||
CREATE OR REPLACE FUNCTION rebuild_auto_complete_taxon_concepts_mview() RETURNS void | ||
LANGUAGE plpgsql | ||
AS $$ | ||
BEGIN | ||
|
||
DROP table IF EXISTS auto_complete_taxon_concepts_mview_tmp CASCADE; | ||
RAISE INFO 'Creating auto complete taxon concepts materialized view (tmp)'; | ||
CREATE TABLE auto_complete_taxon_concepts_mview_tmp AS | ||
SELECT * FROM auto_complete_taxon_concepts_view; | ||
|
||
RAISE INFO 'Creating indexes on auto complete taxon concepts materialized view (tmp)'; | ||
|
||
--this one used for Species+ autocomplete (both main and higher taxa in downloads) | ||
CREATE INDEX ON auto_complete_taxon_concepts_mview_tmp | ||
USING BTREE(name_for_matching text_pattern_ops, taxonomy_is_cites_eu, type_of_match, show_in_species_plus_ac); | ||
--this one used for Checklist autocomplete | ||
CREATE INDEX ON auto_complete_taxon_concepts_mview_tmp | ||
USING BTREE(name_for_matching text_pattern_ops, taxonomy_is_cites_eu, type_of_match, show_in_checklist_ac); | ||
--this one used for Trade autocomplete | ||
CREATE INDEX ON auto_complete_taxon_concepts_mview_tmp | ||
USING BTREE(name_for_matching text_pattern_ops, taxonomy_is_cites_eu, type_of_match, show_in_trade_ac); | ||
--this one used for Trade internal autocomplete | ||
CREATE INDEX ON auto_complete_taxon_concepts_mview_tmp | ||
USING BTREE(name_for_matching text_pattern_ops, taxonomy_is_cites_eu, type_of_match, show_in_trade_internal_ac); | ||
|
||
RAISE INFO 'Swapping auto complete taxon concepts materialized view'; | ||
DROP table IF EXISTS auto_complete_taxon_concepts_mview CASCADE; | ||
ALTER TABLE auto_complete_taxon_concepts_mview_tmp RENAME TO auto_complete_taxon_concepts_mview; | ||
|
||
END; | ||
$$; | ||
|
||
COMMENT ON FUNCTION rebuild_taxon_concepts_mview() IS 'Procedure to rebuild taxon concepts materialized view in the database.'; |
Oops, something went wrong.