Sha256: 0644555d8970c1b5023f04b9bde0e9e6920be7098d4d2f6d060c679939ddc5a7

Contents?: true

Size: 722 Bytes

Versions: 6

Compression:

Stored size: 722 Bytes

Contents

class AddSearchIndexToCasContents < ActiveRecord::Migration[4.2]
  def up
    add_column :cas_contents, :tags_cache, :string
    execute <<-SQL
      CREATE INDEX cas_contents_search_with_fulltext ON cas_contents USING gist ((
        to_tsvector('simple', coalesce("cas_contents"."title"::text, ''))      ||
        to_tsvector('simple', coalesce("cas_contents"."text"::text, ''))       ||
        to_tsvector('simple', coalesce("cas_contents"."location"::text, ''))   ||
        to_tsvector('simple', coalesce("cas_contents"."tags_cache"::text, ''))
      ));
    SQL
  end

  def down
    execute <<-SQL
      DROP INDEX cas_contents_search_with_fulltext;
    SQL
    remove_column :cas_contents, :tags_cache
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cas-cms-1.0.0.alpha2 db/migrate/20170830000001_add_search_index_to_cas_contents.rb
cas-cms-1.0.0.alpha1 db/migrate/20170830000001_add_search_index_to_cas_contents.rb
cas-cms-0.1.3 db/migrate/20170830000001_add_search_index_to_cas_contents.rb
cas-cms-0.1.2 db/migrate/20170830000001_add_search_index_to_cas_contents.rb
cas-cms-0.1.1 db/migrate/20170830000001_add_search_index_to_cas_contents.rb
cas-cms-0.1.0 db/migrate/20170830000001_add_search_index_to_cas_contents.rb