mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-27 10:14:17 +08:00
Fix hound warnings and rename migration [SCI-1157]
This commit is contained in:
parent
07d658ab82
commit
de5043717f
1 changed files with 32 additions and 13 deletions
|
@ -1,43 +1,62 @@
|
||||||
require File.expand_path('app/helpers/database_helper')
|
require File.expand_path('app/helpers/database_helper')
|
||||||
include DatabaseHelper
|
include DatabaseHelper
|
||||||
|
|
||||||
class AddTeamIdToSteps < ActiveRecord::Migration
|
class UpdateIndexesForFasterSearch < ActiveRecord::Migration
|
||||||
def up
|
def up
|
||||||
if db_adapter_is? 'PostgreSQL'
|
if db_adapter_is? 'PostgreSQL'
|
||||||
# Removing old indexes
|
# Removing old indexes
|
||||||
remove_index :projects, :name if index_exists?(:projects, :name)
|
remove_index :projects, :name if index_exists?(:projects, :name)
|
||||||
remove_index :my_modules, :name if index_exists?(:my_modules, :name)
|
remove_index :my_modules, :name if index_exists?(:my_modules, :name)
|
||||||
remove_index :my_modules, :description if index_exists?(:my_modules, :description)
|
if index_exists?(:my_modules, :description)
|
||||||
|
remove_index :my_modules, :description
|
||||||
|
end
|
||||||
remove_index :protocols, :name if index_exists?(:protocols, :name)
|
remove_index :protocols, :name if index_exists?(:protocols, :name)
|
||||||
remove_index :protocols, :description if index_exists?(:protocols, :description)
|
if index_exists?(:protocols, :description)
|
||||||
|
remove_index :protocols, :description
|
||||||
|
end
|
||||||
remove_index :protocols, :authors if index_exists?(:protocols, :authors)
|
remove_index :protocols, :authors if index_exists?(:protocols, :authors)
|
||||||
remove_index :protocol_keywords, :name if index_exists?(:protocol_keywords, :name)
|
if index_exists?(:protocol_keywords, :name)
|
||||||
remove_index :my_module_groups, :name if index_exists?(:my_module_groups, :name)
|
remove_index :protocol_keywords, :name
|
||||||
|
end
|
||||||
|
if index_exists?(:my_module_groups, :name)
|
||||||
|
remove_index :my_module_groups, :name
|
||||||
|
end
|
||||||
remove_index :tags, :name if index_exists?(:tags, :name)
|
remove_index :tags, :name if index_exists?(:tags, :name)
|
||||||
remove_index :results, :name if index_exists?(:results, :name)
|
remove_index :results, :name if index_exists?(:results, :name)
|
||||||
remove_index :result_texts, :text if index_exists?(:result_texts, :text)
|
remove_index :result_texts, :text if index_exists?(:result_texts, :text)
|
||||||
remove_index :reports, :name if index_exists?(:reports, :name)
|
remove_index :reports, :name if index_exists?(:reports, :name)
|
||||||
remove_index :reports, :description if index_exists?(:reports, :description)
|
if index_exists?(:reports, :description)
|
||||||
remove_index :assets, :file_file_name if index_exists?(:assets, :file_file_name)
|
remove_index :reports, :description
|
||||||
|
end
|
||||||
|
if index_exists?(:assets, :file_file_name)
|
||||||
|
remove_index :assets, :file_file_name
|
||||||
|
end
|
||||||
remove_index :samples, :name if index_exists?(:samples, :name)
|
remove_index :samples, :name if index_exists?(:samples, :name)
|
||||||
remove_index :sample_types, :name if index_exists?(:sample_types, :name)
|
remove_index :sample_types, :name if index_exists?(:sample_types, :name)
|
||||||
remove_index :sample_groups, :name if index_exists?(:sample_groups, :name)
|
remove_index :sample_groups, :name if index_exists?(:sample_groups, :name)
|
||||||
remove_index :sample_custom_fields, :value if index_exists?(:sample_custom_fields, :value)
|
if index_exists?(:sample_custom_fields, :value)
|
||||||
|
remove_index :sample_custom_fields, :value
|
||||||
|
end
|
||||||
remove_index :steps, :name if index_exists?(:steps, :name)
|
remove_index :steps, :name if index_exists?(:steps, :name)
|
||||||
remove_index :steps, :description if index_exists?(:steps, :description)
|
remove_index :steps, :description if index_exists?(:steps, :description)
|
||||||
remove_index :checklists, :name if index_exists?(:checklists, :name)
|
remove_index :checklists, :name if index_exists?(:checklists, :name)
|
||||||
remove_index :checklist_items, :text if index_exists?(:checklist_items, :text)
|
if index_exists?(:checklist_items, :text)
|
||||||
|
remove_index :checklist_items, :text
|
||||||
|
end
|
||||||
remove_index :tables, :name if index_exists?(:tables, :name)
|
remove_index :tables, :name if index_exists?(:tables, :name)
|
||||||
remove_index :users, :full_name if index_exists?(:users, :full_name)
|
remove_index :users, :full_name if index_exists?(:users, :full_name)
|
||||||
remove_index :comments, :message if index_exists?(:comments, :message)
|
remove_index :comments, :message if index_exists?(:comments, :message)
|
||||||
remove_index :comments, :type if index_exists?(:comments, :type)
|
remove_index :comments, :type if index_exists?(:comments, :type)
|
||||||
remove_index :protocols, :protocol_type if index_exists?(:protocols, :protocol_type)
|
if index_exists?(:protocols, :protocol_type)
|
||||||
|
remove_index :protocols, :protocol_type
|
||||||
|
end
|
||||||
remove_index :checklists, :step_id if index_exists?(:checklists, :step_id)
|
remove_index :checklists, :step_id if index_exists?(:checklists, :step_id)
|
||||||
|
|
||||||
execute(
|
execute(
|
||||||
"CREATE OR REPLACE FUNCTION trim_html_tags(IN input TEXT, OUT output TEXT) AS $$
|
"CREATE OR REPLACE FUNCTION
|
||||||
|
trim_html_tags(IN input TEXT, OUT output TEXT) AS $$
|
||||||
SELECT regexp_replace(input,
|
SELECT regexp_replace(input,
|
||||||
E'<.*?>|\\\\[#.*\\\\]|\\\\[@.*\\\\]',
|
E'<[^>]*>|\\\\[#.*\\\\]|\\\\[@.*\\\\]',
|
||||||
'',
|
'',
|
||||||
'g');
|
'g');
|
||||||
$$ LANGUAGE SQL;"
|
$$ LANGUAGE SQL;"
|
||||||
|
@ -56,7 +75,7 @@ class AddTeamIdToSteps < ActiveRecord::Migration
|
||||||
add_gin_index_without_tags :result_texts, :text
|
add_gin_index_without_tags :result_texts, :text
|
||||||
add_gin_index_without_tags :reports, :name
|
add_gin_index_without_tags :reports, :name
|
||||||
add_gin_index_without_tags :reports, :description
|
add_gin_index_without_tags :reports, :description
|
||||||
add_gist_index :assets, :file_file_name
|
add_gin_index_without_tags :assets, :file_file_name
|
||||||
add_gin_index_without_tags :samples, :name
|
add_gin_index_without_tags :samples, :name
|
||||||
add_gin_index_without_tags :sample_types, :name
|
add_gin_index_without_tags :sample_types, :name
|
||||||
add_gin_index_without_tags :sample_groups, :name
|
add_gin_index_without_tags :sample_groups, :name
|
Loading…
Reference in a new issue