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

class AddIndexOnSnippetContent < ActiveRecord::Migration[5.2]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false
  INDEX_NAME = 'index_snippets_on_content_trigram'

  disable_ddl_transaction!

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

  def down
    remove_concurrent_index_by_name(:snippets, INDEX_NAME)
  end
end