diff --git a/db/migrate/20130709155651_add_gist_index_for_wiki_page_search.rb b/db/migrate/20130709155651_add_gist_index_for_wiki_page_search.rb deleted file mode 100644 index 33b989a8f4f..00000000000 --- a/db/migrate/20130709155651_add_gist_index_for_wiki_page_search.rb +++ /dev/null @@ -1,27 +0,0 @@ -class AddGistIndexForWikiPageSearch < ActiveRecord::Migration - self.transactional = false - tag :predeploy - - def self.up - if is_postgres? - connection.transaction(:requires_new => true) do - begin - execute('create extension if not exists pg_trgm;') - rescue ActiveRecord::StatementInvalid - raise ActiveRecord::Rollback - end - end - - if has_postgres_proc?('show_trgm') - concurrently = " CONCURRENTLY" if connection.open_transactions == 0 - execute("create index#{concurrently} index_trgm_wiki_pages_title on wiki_pages USING gist(lower(title) gist_trgm_ops);") - end - end - end - - def self.down - if is_postgres? - execute('drop index if exists index_trgm_wiki_pages_title;') - end - end -end diff --git a/db/migrate/20130723170139_add_gist_indexes_for_api_search.rb b/db/migrate/20130723170139_add_gist_indexes_for_api_search.rb deleted file mode 100644 index 5cf0da465f0..00000000000 --- a/db/migrate/20130723170139_add_gist_indexes_for_api_search.rb +++ /dev/null @@ -1,33 +0,0 @@ -class AddGistIndexesForApiSearch < ActiveRecord::Migration - self.transactional = false - tag :postdeploy - - def self.up - if is_postgres? - connection.transaction(:requires_new => true) do - begin - execute('create extension if not exists pg_trgm;') - rescue ActiveRecord::StatementInvalid - raise ActiveRecord::Rollback - end - end - - if has_postgres_proc?('show_trgm') - concurrently = " CONCURRENTLY" if connection.open_transactions == 0 - execute("create index#{concurrently} index_trgm_context_external_tools_name on context_external_tools USING gist(lower(name) gist_trgm_ops);") - execute("create index#{concurrently} index_trgm_assignments_title on assignments USING gist(lower(title) gist_trgm_ops);") - execute("create index#{concurrently} index_trgm_quizzes_title on quizzes USING gist(lower(title) gist_trgm_ops);") - execute("create index#{concurrently} index_trgm_discussion_topics_title on discussion_topics USING gist(lower(title) gist_trgm_ops);") - end - end - end - - def self.down - if is_postgres? - execute('drop index if exists index_trgm_context_external_tools_name;') - execute('drop index if exists index_trgm_assignments_title;') - execute('drop index if exists index_trgm_quizzes_title;') - execute('drop index if exists index_trgm_discussion_topics_title;') - end - end -end diff --git a/db/migrate/20130729175222_add_additional_gist_indexes_for_api_search.rb b/db/migrate/20130729175222_add_additional_gist_indexes_for_api_search.rb deleted file mode 100644 index c66811234e3..00000000000 --- a/db/migrate/20130729175222_add_additional_gist_indexes_for_api_search.rb +++ /dev/null @@ -1,31 +0,0 @@ -class AddAdditionalGistIndexesForApiSearch < ActiveRecord::Migration - self.transactional = false - tag :postdeploy - - def self.up - if is_postgres? - connection.transaction(:requires_new => true) do - begin - execute('create extension if not exists pg_trgm;') - rescue ActiveRecord::StatementInvalid - raise ActiveRecord::Rollback - end - end - - if has_postgres_proc?('show_trgm') - concurrently = " CONCURRENTLY" if connection.open_transactions == 0 - execute("create index#{concurrently} index_trgm_attachments_display_name on attachments USING gist(lower(display_name) gist_trgm_ops);") - execute("create index#{concurrently} index_trgm_context_modules_name on context_modules USING gist(lower(name) gist_trgm_ops);") - execute("create index#{concurrently} index_trgm_content_tags_title on content_tags USING gist(lower(title) gist_trgm_ops);") - end - end - end - - def self.down - if is_postgres? - execute('drop index if exists index_trgm_attachments_display_name;') - execute('drop index if exists index_trgm_context_modules_name;') - execute('drop index if exists index_trgm_content_tags_title;') - end - end -end diff --git a/db/migrate/20130823204503_remove_unneeded_gist_indexes.rb b/db/migrate/20130823204503_remove_unneeded_gist_indexes.rb new file mode 100644 index 00000000000..c923eaad334 --- /dev/null +++ b/db/migrate/20130823204503_remove_unneeded_gist_indexes.rb @@ -0,0 +1,19 @@ +class RemoveUnneededGistIndexes < ActiveRecord::Migration + tag :predeploy + + def self.up + if is_postgres? + execute('drop index if exists index_trgm_wiki_pages_title;') + execute('drop index if exists index_trgm_context_external_tools_name;') + execute('drop index if exists index_trgm_assignments_title;') + execute('drop index if exists index_trgm_quizzes_title;') + execute('drop index if exists index_trgm_discussion_topics_title;') + execute('drop index if exists index_trgm_attachments_display_name;') + execute('drop index if exists index_trgm_context_modules_name;') + execute('drop index if exists index_trgm_content_tags_title;') + end + end + + def self.down + end +end