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

class AddIndexToTags < ActiveRecord::Migration[5.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false
  INDEX_NAME = 'index_tags_on_name_trigram'

  disable_ddl_transaction!

  def up
    add_concurrent_index :tags, :name, name: INDEX_NAME, using: :gin, opclasses: { name: :gin_trgm_ops }
  end

  def down
    remove_concurrent_index_by_name(:tags, INDEX_NAME)
  end
end