Migration added that fixes full-text search

This commit is contained in:
Christoph Haas 2014-12-31 17:32:53 +01:00
parent e8fb97c21e
commit d895aa2d1d

View file

@ -0,0 +1,17 @@
class FixSearchIndexInPackages < ActiveRecord::Migration
def up
execute "drop index packages_name"
execute "drop index packages_description"
execute "create index packages_fts on packages using gin((
to_tsvector('english', coalesce(\"packages\".\"name\"::text, ''))
||
to_tsvector('english', coalesce(\"packages\".\"description\"::text, ''))
||
to_tsvector('english', coalesce(\"packages\".\"long_description\"::text, ''))
))"
end
def down
execute "drop index packages_fts"
end
end