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

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

  DOWNTIME = false
  INDEX_NAME = 'index_routes_on_path_trigram'

  disable_ddl_transaction!

  def up
    add_concurrent_index :routes, :path, name: INDEX_NAME, using: :gin, opclass: { path: :gin_trgm_ops }
  end

  def down
    remove_concurrent_index_by_name(:routes, INDEX_NAME)
  end
end