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

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

  # uses `pe_` instead of `protected_environment_` because index limit is 63 characters
  INDEX_NAME = 'index_pe_approval_rules_on_required_approvals_and_created_at'

  def up
    add_concurrent_index :protected_environment_approval_rules, %i[required_approvals created_at], name: INDEX_NAME
  end

  def down
    remove_concurrent_index :protected_environment_approval_rules, %i[required_approvals created_at], name: INDEX_NAME
  end
end