debshots/db/migrate/20141229173351_fix_search_index_in_packages.rb

17 lines
546 B
Ruby

class FixSearchIndexInPackages < ActiveRecord::Migration[5.0]
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