summaryrefslogtreecommitdiff
path: root/db/migrate/20220602130306_add_namespace_type_index.rb
blob: b20f36b3278b5bff45f211e2673052274bd44f62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# frozen_string_literal: true

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

  INDEX_NAME = 'index_groups_on_parent_id_id'

  def up
    add_concurrent_index :namespaces, [:parent_id, :id], where: "type = 'Group'", name: INDEX_NAME
  end

  def down
    remove_concurrent_index_by_name(:namespaces, INDEX_NAME)
  end
end