From 0e40b41e224f18076426578da08548ae22afdcd1 Mon Sep 17 00:00:00 2001 From: Kerri Miller Date: Thu, 5 Sep 2019 13:01:36 +0000 Subject: Add structure to support EE feature of COAR These are the structural changes for supporting the EE feature of moving "code_owner_approval_required" state from existing on a project to being on the protected branches individually, allowing for CODEOWNER validation on push events. --- ...re_code_owner_approval_to_protected_branches.rb | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 db/migrate/20190729180447_add_merge_requests_require_code_owner_approval_to_protected_branches.rb (limited to 'db/migrate/20190729180447_add_merge_requests_require_code_owner_approval_to_protected_branches.rb') diff --git a/db/migrate/20190729180447_add_merge_requests_require_code_owner_approval_to_protected_branches.rb b/db/migrate/20190729180447_add_merge_requests_require_code_owner_approval_to_protected_branches.rb new file mode 100644 index 00000000000..098fcff9ace --- /dev/null +++ b/db/migrate/20190729180447_add_merge_requests_require_code_owner_approval_to_protected_branches.rb @@ -0,0 +1,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 -- cgit v1.2.3