~cytrogen/masto-fe

ref: 9ae60f8738466746124f50ee261ea204db6b8537 masto-fe/db/migrate/20170317193015_add_search_index_to_accounts.rb -rw-r--r-- 451 bytes
9ae60f87 — Claire Merge commit '82e477b184b5666fff7fb55933dce22ca2925db8' into glitch-soc/merge-upstream 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
# frozen_string_literal: true

class AddSearchIndexToAccounts < ActiveRecord::Migration[5.0]
  def up
    execute 'CREATE INDEX search_index ON accounts USING gin((setweight(to_tsvector(\'simple\', accounts.display_name), \'A\') || setweight(to_tsvector(\'simple\', accounts.username), \'B\') || setweight(to_tsvector(\'simple\', coalesce(accounts.domain, \'\')), \'C\')));'
  end

  def down
    remove_index :accounts, name: :search_index
  end
end