Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
class AddIndexForSearchableFieldsInDevelopers < ActiveRecord::Migration[7.0]
def up
execute <<-SQL
ALTER TABLE developers
ADD COLUMN textsearchable_index_col tsvector
GENERATED ALWAYS AS (to_tsvector('simple', coalesce(hero, '') || ' ' || coalesce(bio, ''))) STORED;
SQL
add_index :developers, :textsearchable_index_col, using: :gin, name: :textsearchable_index
end
def down
remove_index :developers, name: :textsearchable_index
remove_column :developers, :textsearchable_index_col
end
end