Welcome to mirror list, hosted at ThFree Co, Russian Federation.

20231115172623_remove_name_description_trigram_indexes_from_catalog_resources.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4dc02efa0bed3c38227eaca6c50163de36e57920 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

class RemoveNameDescriptionTrigramIndexesFromCatalogResources < Gitlab::Database::Migration[2.2]
  milestone '16.7'

  disable_ddl_transaction!

  NAME_TRIGRAM_INDEX = 'index_catalog_resources_on_name_trigram'
  DESCRIPTION_TRIGRAM_INDEX = 'index_catalog_resources_on_description_trigram'

  def up
    remove_concurrent_index_by_name :catalog_resources, NAME_TRIGRAM_INDEX
    remove_concurrent_index_by_name :catalog_resources, DESCRIPTION_TRIGRAM_INDEX
  end

  def down
    add_concurrent_index :catalog_resources, :name, name: NAME_TRIGRAM_INDEX,
      using: :gin, opclass: { name: :gin_trgm_ops }

    add_concurrent_index :catalog_resources, :description, name: DESCRIPTION_TRIGRAM_INDEX,
      using: :gin, opclass: { description: :gin_trgm_ops }
  end
end