Commit 1e69e7ef authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch...

Merge branch '222313-update-usage-ping-data-to-track-projects-with-can-override-approvals-in-merge-request' into 'master'

Update usage ping data to track projects with overridden approval rules

See merge request gitlab-org/gitlab!35224
parents e222b6a2 3c931406
---
title: Add project count with overridden approval rules in merge request to usage ping
merge_request: 35224
author:
type: added
# frozen_string_literal: true
class AddDisableOverridingApproversPerMergeRequestIndices < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
DISABLE_OVERRIDING_APPROVERS_TRUE_INDEX_NAME = "idx_projects_id_created_at_disable_overriding_approvers_true"
DISABLE_OVERRIDING_APPROVERS_FALSE_INDEX_NAME = "idx_projects_id_created_at_disable_overriding_approvers_false"
disable_ddl_transaction!
def up
add_concurrent_index :projects, [:id, :created_at],
where: "disable_overriding_approvers_per_merge_request = TRUE",
name: DISABLE_OVERRIDING_APPROVERS_TRUE_INDEX_NAME
add_concurrent_index :projects, [:id, :created_at],
where: "(disable_overriding_approvers_per_merge_request = FALSE) OR (disable_overriding_approvers_per_merge_request IS NULL)",
name: DISABLE_OVERRIDING_APPROVERS_FALSE_INDEX_NAME
end
def down
remove_concurrent_index_by_name :projects, DISABLE_OVERRIDING_APPROVERS_TRUE_INDEX_NAME
remove_concurrent_index_by_name :projects, DISABLE_OVERRIDING_APPROVERS_FALSE_INDEX_NAME
end
end
...@@ -18393,6 +18393,10 @@ CREATE UNIQUE INDEX idx_project_id_payload_key_self_managed_prometheus_alert_eve ...@@ -18393,6 +18393,10 @@ CREATE UNIQUE INDEX idx_project_id_payload_key_self_managed_prometheus_alert_eve
CREATE INDEX idx_project_repository_check_partial ON public.projects USING btree (repository_storage, created_at) WHERE (last_repository_check_at IS NULL); CREATE INDEX idx_project_repository_check_partial ON public.projects USING btree (repository_storage, created_at) WHERE (last_repository_check_at IS NULL);
CREATE INDEX idx_projects_id_created_at_disable_overriding_approvers_false ON public.projects USING btree (id, created_at) WHERE ((disable_overriding_approvers_per_merge_request = false) OR (disable_overriding_approvers_per_merge_request IS NULL));
CREATE INDEX idx_projects_id_created_at_disable_overriding_approvers_true ON public.projects USING btree (id, created_at) WHERE (disable_overriding_approvers_per_merge_request = true);
CREATE INDEX idx_projects_on_repository_storage_last_repository_updated_at ON public.projects USING btree (id, repository_storage, last_repository_updated_at); CREATE INDEX idx_projects_on_repository_storage_last_repository_updated_at ON public.projects USING btree (id, repository_storage, last_repository_updated_at);
CREATE INDEX idx_repository_states_on_last_repository_verification_ran_at ON public.project_repository_states USING btree (project_id, last_repository_verification_ran_at) WHERE ((repository_verification_checksum IS NOT NULL) AND (last_repository_verification_failure IS NULL)); CREATE INDEX idx_repository_states_on_last_repository_verification_ran_at ON public.project_repository_states USING btree (project_id, last_repository_verification_ran_at) WHERE ((repository_verification_checksum IS NOT NULL) AND (last_repository_verification_failure IS NULL));
...@@ -23531,6 +23535,7 @@ COPY "schema_migrations" (version) FROM STDIN; ...@@ -23531,6 +23535,7 @@ COPY "schema_migrations" (version) FROM STDIN;
20200625045442 20200625045442
20200625082258 20200625082258
20200625190458 20200625190458
20200626060151
20200626130220 20200626130220
\. \.
...@@ -218,6 +218,8 @@ module EE ...@@ -218,6 +218,8 @@ module EE
projects_enforcing_code_owner_approval: distinct_count(::Project.requiring_code_owner_approval.where(time_period), :creator_id), projects_enforcing_code_owner_approval: distinct_count(::Project.requiring_code_owner_approval.where(time_period), :creator_id),
merge_requests_with_optional_codeowners: distinct_count(::ApprovalMergeRequestRule.code_owner_approval_optional.where(time_period), :merge_request_id), merge_requests_with_optional_codeowners: distinct_count(::ApprovalMergeRequestRule.code_owner_approval_optional.where(time_period), :merge_request_id),
merge_requests_with_required_codeowners: distinct_count(::ApprovalMergeRequestRule.code_owner_approval_required.where(time_period), :merge_request_id), merge_requests_with_required_codeowners: distinct_count(::ApprovalMergeRequestRule.code_owner_approval_required.where(time_period), :merge_request_id),
projects_with_disable_overriding_approvers_per_merge_request: count(::Project.where(time_period.merge(disable_overriding_approvers_per_merge_request: true))),
projects_without_disable_overriding_approvers_per_merge_request: count(::Project.where(time_period.merge(disable_overriding_approvers_per_merge_request: [false, nil]))),
projects_imported_from_github: distinct_count(::Project.github_imported.where(time_period), :creator_id), projects_imported_from_github: distinct_count(::Project.github_imported.where(time_period), :creator_id),
projects_with_repositories_enabled: distinct_count(::Project.with_repositories_enabled.where(time_period), projects_with_repositories_enabled: distinct_count(::Project.with_repositories_enabled.where(time_period),
:creator_id, :creator_id,
......
...@@ -331,6 +331,8 @@ RSpec.describe Gitlab::UsageData do ...@@ -331,6 +331,8 @@ RSpec.describe Gitlab::UsageData do
create(:deploy_key, user: user) create(:deploy_key, user: user)
create(:key, user: user) create(:key, user: user)
create(:project, creator: user) create(:project, creator: user)
create(:project, creator: user, disable_overriding_approvers_per_merge_request: true)
create(:project, creator: user, disable_overriding_approvers_per_merge_request: false)
create(:protected_branch, project: project) create(:protected_branch, project: project)
create(:remote_mirror, project: project) create(:remote_mirror, project: project)
create(:snippet, author: user) create(:snippet, author: user)
...@@ -348,6 +350,8 @@ RSpec.describe Gitlab::UsageData do ...@@ -348,6 +350,8 @@ RSpec.describe Gitlab::UsageData do
projects_enforcing_code_owner_approval: 0, projects_enforcing_code_owner_approval: 0,
merge_requests_with_optional_codeowners: 4, merge_requests_with_optional_codeowners: 4,
merge_requests_with_required_codeowners: 8, merge_requests_with_required_codeowners: 8,
projects_with_disable_overriding_approvers_per_merge_request: 2,
projects_without_disable_overriding_approvers_per_merge_request: 16,
projects_imported_from_github: 2, projects_imported_from_github: 2,
projects_with_repositories_enabled: 12, projects_with_repositories_enabled: 12,
protected_branches: 2, protected_branches: 2,
...@@ -363,6 +367,8 @@ RSpec.describe Gitlab::UsageData do ...@@ -363,6 +367,8 @@ RSpec.describe Gitlab::UsageData do
merge_requests_users: 0, merge_requests_users: 0,
merge_requests_with_optional_codeowners: 2, merge_requests_with_optional_codeowners: 2,
merge_requests_with_required_codeowners: 4, merge_requests_with_required_codeowners: 4,
projects_with_disable_overriding_approvers_per_merge_request: 1,
projects_without_disable_overriding_approvers_per_merge_request: 8,
projects_imported_from_github: 1, projects_imported_from_github: 1,
projects_with_repositories_enabled: 6, projects_with_repositories_enabled: 6,
protected_branches: 1, protected_branches: 1,
......
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