summaryrefslogtreecommitdiff
path: root/db/migrate/20200303074328_add_index_on_snippet_description.rb
blob: f23e5f8bf8ec2e99976f43952bd9ffd700c9eeb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

class AddIndexOnSnippetDescription < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false
  INDEX_NAME = 'index_snippets_on_description_trigram'

  disable_ddl_transaction!

  def up
    add_concurrent_index :snippets, :description, name: INDEX_NAME, using: :gin, opclass: { description: :gin_trgm_ops }
  end

  def down
    remove_concurrent_index_by_name :snippets, INDEX_NAME
  end
end