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

20190729180447_add_merge_requests_require_code_owner_approval_to_protected_branches.rb « migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 098fcff9acee9cdad19b2103402ef8bc378cec78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# frozen_string_literal: true

class AddMergeRequestsRequireCodeOwnerApprovalToProtectedBranches < ActiveRecord::Migration[5.2]
  include Gitlab::Database::MigrationHelpers

  # Set this constant to true if this migration requires downtime.
  DOWNTIME = false

  disable_ddl_transaction!

  def up
    add_column_with_default(
      :protected_branches,
      :code_owner_approval_required,
      :boolean,
      default: false
    )

    add_concurrent_index(
      :protected_branches,
      [:project_id, :code_owner_approval_required],
      name: "code_owner_approval_required",
      where: "code_owner_approval_required = #{Gitlab::Database.true_value}")
  end

  def down
    remove_concurrent_index(:protected_branches, name: "code_owner_approval_required")

    remove_column(:protected_branches, :code_owner_approval_required)
  end
end