[noosfero/noosfero][master] pg_search: fix down on migration

Bráulio Bhavamitra gitlab at gitlab.com
Wed Mar 18 16:38:49 BRT 2015


Bráulio Bhavamitra pushed to master at Noosfero / noosfero


Commits:
da29b595 by Braulio Bhavamitra at 2015-03-18T16:38:38Z
pg_search: fix down on migration

- - - - -


1 changed file:

- plugins/pg_search/db/migrate/20130320010063_create_indexes_for_search.rb


Changes:

=====================================
plugins/pg_search/db/migrate/20130320010063_create_indexes_for_search.rb
=====================================
--- 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


View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/da29b595e64d29a3a032095b7457c9ebbc972034
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20150318/c0dc6974/attachment.html>


More information about the Noosfero-dev mailing list