Commit c4fdb208 authored by Tiger Watson's avatar Tiger Watson

Merge branch '230835-drop-code_owner-column-from-approvalmergerequestrule' into 'master'

Drop `code_owner` column from ApprovalMergeRequestRule

Closes #230835

See merge request gitlab-org/gitlab!40322
parents d69d13ea 6a48fe85
---
title: Drop code_owner column from approval_merge_request_rules
merge_request: 40322
author:
type: other
# frozen_string_literal: true
class DropCodeOwnerColumnFromApprovalMergeRequestRule < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
with_lock_retries do
remove_column :approval_merge_request_rules, :code_owner
end
end
def down
unless column_exists?(:approval_merge_request_rules, :code_owner)
with_lock_retries do
add_column :approval_merge_request_rules, :code_owner, :boolean, default: false, null: false
end
end
add_concurrent_index(
:approval_merge_request_rules,
[:merge_request_id, :code_owner, :name],
unique: true,
where: "code_owner = true AND section IS NULL",
name: "approval_rule_name_index_for_code_owners"
)
add_concurrent_index(
:approval_merge_request_rules,
[:merge_request_id, :code_owner],
name: "index_approval_merge_request_rules_1"
)
end
end
6fb93002ffd5c1d1bfff5bea8a99cbbfc7cefefbc450a9d067ee0cfab8d11e9e
\ No newline at end of file
......@@ -9304,7 +9304,6 @@ CREATE TABLE public.approval_merge_request_rules (
updated_at timestamp with time zone NOT NULL,
merge_request_id integer NOT NULL,
approvals_required smallint DEFAULT 0 NOT NULL,
code_owner boolean DEFAULT false NOT NULL,
name character varying NOT NULL,
rule_type smallint DEFAULT 1 NOT NULL,
report_type smallint,
......@@ -19048,8 +19047,6 @@ CREATE UNIQUE INDEX any_approver_project_rule_type_unique_index ON public.approv
CREATE INDEX approval_mr_rule_index_merge_request_id ON public.approval_merge_request_rules USING btree (merge_request_id);
CREATE UNIQUE INDEX approval_rule_name_index_for_code_owners ON public.approval_merge_request_rules USING btree (merge_request_id, code_owner, name) WHERE ((code_owner = true) AND (section IS NULL));
CREATE UNIQUE INDEX backup_labels_group_id_project_id_title_idx ON public.backup_labels USING btree (group_id, project_id, title);
CREATE INDEX backup_labels_group_id_title_idx ON public.backup_labels USING btree (group_id, title) WHERE (project_id = NULL::integer);
......@@ -19222,8 +19219,6 @@ CREATE UNIQUE INDEX index_approval_merge_request_rule_sources_1 ON public.approv
CREATE INDEX index_approval_merge_request_rule_sources_2 ON public.approval_merge_request_rule_sources USING btree (approval_project_rule_id);
CREATE INDEX index_approval_merge_request_rules_1 ON public.approval_merge_request_rules USING btree (merge_request_id, code_owner);
CREATE UNIQUE INDEX index_approval_merge_request_rules_approved_approvers_1 ON public.approval_merge_request_rules_approved_approvers USING btree (approval_merge_request_rule_id, user_id);
CREATE INDEX index_approval_merge_request_rules_approved_approvers_2 ON public.approval_merge_request_rules_approved_approvers USING btree (user_id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment