From da29b595e64d29a3a032095b7457c9ebbc972034 Mon Sep 17 00:00:00 2001 From: Braulio Bhavamitra Date: Wed, 18 Mar 2015 16:38:10 -0300 Subject: [PATCH] pg_search: fix down on migration --- plugins/pg_search/db/migrate/20130320010063_create_indexes_for_search.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/pg_search/db/migrate/20130320010063_create_indexes_for_search.rb b/plugins/pg_search/db/migrate/20130320010063_create_indexes_for_search.rb index 633bbce..4dd2f20 100644 --- a/plugins/pg_search/db/migrate/20130320010063_create_indexes_for_search.rb +++ b/plugins/pg_search/db/migrate/20130320010063_create_indexes_for_search.rb @@ -1,15 +1,15 @@ class CreateIndexesForSearch < ActiveRecord::Migration + SEARCHABLES = %w[ article comment qualifier national_region certifier profile license scrap category ] + KLASSES = SEARCHABLES.map {|searchable| searchable.camelize.constantize } def self.up - searchables = %w[ article comment qualifier national_region certifier profile license scrap category ] - klasses = searchables.map {|searchable| searchable.camelize.constantize } - klasses.each do |klass| + KLASSES.each do |klass| fields = klass.pg_search_plugin_fields execute "create index pg_search_plugin_#{klass.name.singularize.downcase} on #{klass.table_name} using gin(to_tsvector('simple', #{fields}))" end end def self.down - klasses.each do |klass| + KLASSES.each do |klass| execute "drop index pg_search_plugin_#{klass.name.singularize.downcase}" end end -- libgit2 0.21.2