2019-09-05 13:01:36 +00:00
|
|
|
# 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
|
2019-12-27 18:08:12 +00:00
|
|
|
add_column_with_default( # rubocop:disable Migration/AddColumnWithDefault
|
2019-09-05 13:01:36 +00:00
|
|
|
: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
|