mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-11-11 17:00:41 +08:00
Remove check for database in migrations [SCI-11213]
This commit is contained in:
parent
501e5a920d
commit
e3e340d977
8 changed files with 180 additions and 203 deletions
|
|
@ -3,8 +3,6 @@ include DatabaseHelper
|
|||
|
||||
class AddPgTrgmSupport < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
if db_adapter_is? "PostgreSQL" then
|
||||
enable_extension :pg_trgm
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ class AddSearchQueryIndexes < ActiveRecord::Migration[4.2]
|
|||
|
||||
# Add GIST trigram indexes onto columns that check for
|
||||
# ILIKE %pattern% during search
|
||||
if db_adapter_is? "PostgreSQL" then
|
||||
add_gist_index :projects, :name
|
||||
add_gist_index :my_modules, :name
|
||||
add_gist_index :my_module_groups, :name
|
||||
|
|
@ -24,7 +23,6 @@ class AddSearchQueryIndexes < ActiveRecord::Migration[4.2]
|
|||
remove_index :samples, :name
|
||||
add_gist_index :samples, :name
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
remove_index :projects, :team_id
|
||||
|
|
@ -34,7 +32,6 @@ class AddSearchQueryIndexes < ActiveRecord::Migration[4.2]
|
|||
remove_index :user_projects, :project_id
|
||||
remove_index :tags, :project_id
|
||||
|
||||
if db_adapter_is? "PostgreSQL" then
|
||||
remove_index :projects, :name
|
||||
remove_index :my_modules, :name
|
||||
remove_index :my_module_groups, :name
|
||||
|
|
@ -47,4 +44,3 @@ class AddSearchQueryIndexes < ActiveRecord::Migration[4.2]
|
|||
add_index :samples, :name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@ include DatabaseHelper
|
|||
|
||||
class AddBtreeGistExtension < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
if db_adapter_is? "PostgreSQL" then
|
||||
enable_extension :btree_gist
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@ class AddTextSearchVectorToAssetTextData < ActiveRecord::Migration[4.2]
|
|||
def change
|
||||
add_column :asset_text_data, :data_vector, :tsvector
|
||||
|
||||
if db_adapter_is? "PostgreSQL" then
|
||||
add_index :asset_text_data, :data_vector, using: "gin"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@ class AddTextSearchVectorToTables < ActiveRecord::Migration[4.2]
|
|||
def change
|
||||
add_column :tables, :data_vector, :tsvector
|
||||
|
||||
if db_adapter_is? "PostgreSQL" then
|
||||
add_index :tables, :data_vector, using: "gin"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ include DatabaseHelper
|
|||
|
||||
class GenerateTextSearchVectorForTableContents < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
if db_adapter_is? "PostgreSQL" then
|
||||
execute <<-SQL
|
||||
UPDATE tables
|
||||
SET data_vector =
|
||||
|
|
@ -11,4 +10,3 @@ class GenerateTextSearchVectorForTableContents < ActiveRecord::Migration[4.2]
|
|||
SQL
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ include DatabaseHelper
|
|||
|
||||
class UpdateIndexesForFasterSearch < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
if db_adapter_is? 'PostgreSQL'
|
||||
# Removing old indexes
|
||||
if index_name_exists? :projects, :index_projects_on_name
|
||||
remove_index :projects, name: :index_projects_on_name
|
||||
|
|
@ -127,13 +126,11 @@ class UpdateIndexesForFasterSearch < ActiveRecord::Migration[4.2]
|
|||
add_index :protocols, :protocol_type
|
||||
add_index :checklists, :step_id
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
# remove_index :steps, :team_id
|
||||
# remove_column :steps, :team_id, :integer
|
||||
|
||||
if db_adapter_is? 'PostgreSQL'
|
||||
remove_index :projects, :name
|
||||
remove_index :my_modules, :name
|
||||
remove_index :my_modules, :description
|
||||
|
|
@ -161,8 +158,6 @@ class UpdateIndexesForFasterSearch < ActiveRecord::Migration[4.2]
|
|||
remove_index :comments, :type
|
||||
remove_index :protocols, :protocol_type
|
||||
remove_index :checklists, :step_id
|
||||
|
||||
execute('DROP FUNCTION IF EXISTS trim_html_tags(IN input TEXT);')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,19 +3,15 @@ include DatabaseHelper
|
|||
|
||||
class AddSearchIndexesToRepositories < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
if db_adapter_is? 'PostgreSQL'
|
||||
if index_exists?(:repository_rows, :name)
|
||||
remove_index :repository_rows, :name
|
||||
end
|
||||
add_gin_index_without_tags :repository_rows, :name
|
||||
add_gin_index_without_tags :repository_text_values, :data
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
if db_adapter_is? 'PostgreSQL'
|
||||
remove_index :repository_rows, :name
|
||||
remove_index :repository_text_values, :data
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue