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

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

  # skips the `required_` part because index limit is 63 characters
  INDEX_NAME = 'index_protected_environments_on_approval_count_and_created_at'

  def up
    add_concurrent_index :protected_environments, %i[required_approval_count created_at], name: INDEX_NAME
  end

  def down
    remove_concurrent_index :protected_environments, %i[required_approval_count created_at], name: INDEX_NAME
  end
end