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

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

class DropIndexNamespacesOnTypeAndVisibilityAndParentId < Gitlab::Database::Migration[2.1]
  disable_ddl_transaction!

  TABLE_NAME = 'namespaces'
  INDEX_NAME = 'index_namespaces_on_type_and_visibility_and_parent_id'
  CONDITIONS = "(type = 'Group' AND parent_id IS NULL AND visibility_level != 20)"

  def up
    remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME
  end

  def down
    add_concurrent_index TABLE_NAME, :id, name: INDEX_NAME, where: CONDITIONS
  end
end