scinote-web/db/migrate/20170619125051_add_search_indexes_to_repositories.rb
2017-06-27 13:23:51 +02:00

22 lines
583 B
Ruby

require File.expand_path('app/helpers/database_helper')
include DatabaseHelper
class AddSearchIndexesToRepositories < ActiveRecord::Migration
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