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

20220502125053_recreate_index_for_project_group_link_with_group_id_and_project_id.rb « migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1d9a18b7b232fcfe493e9337f82cd5a689f81ff5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

class RecreateIndexForProjectGroupLinkWithGroupIdAndProjectId < Gitlab::Database::Migration[2.0]
  disable_ddl_transaction!

  OLD_INDEX_NAME = 'index_project_group_links_on_group_id'
  NEW_INDEX_NAME = 'index_project_group_links_on_group_id_and_project_id'

  def up
    add_concurrent_index :project_group_links, [:group_id, :project_id], name: NEW_INDEX_NAME
    remove_concurrent_index_by_name :project_group_links, OLD_INDEX_NAME
  end

  def down
    add_concurrent_index :project_group_links, [:group_id], name: OLD_INDEX_NAME
    remove_concurrent_index_by_name :project_group_links, NEW_INDEX_NAME
  end
end