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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorKerri Miller <kerrizor@kerrizor.com>2019-09-05 16:01:36 +0300
committerNick Thomas <nick@gitlab.com>2019-09-05 16:01:36 +0300
commit0e40b41e224f18076426578da08548ae22afdcd1 (patch)
tree3bf58eb8e415771f28270910a66672b4d9db87b9 /db
parent95ef27253909ba7ff30667af14f7ea2256c1ae8d (diff)
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.
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20190729180447_add_merge_requests_require_code_owner_approval_to_protected_branches.rb31
-rw-r--r--db/schema.rb2
2 files changed, 33 insertions, 0 deletions
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
diff --git a/db/schema.rb b/db/schema.rb
index 98c4403efe1..9d7cdaed70c 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -2932,6 +2932,8 @@ ActiveRecord::Schema.define(version: 2019_09_04_173203) do
t.string "name", null: false
t.datetime "created_at"
t.datetime "updated_at"
+ t.boolean "code_owner_approval_required", default: false, null: false
+ t.index ["project_id", "code_owner_approval_required"], name: "code_owner_approval_required", where: "(code_owner_approval_required = true)"
t.index ["project_id"], name: "index_protected_branches_on_project_id"
end