Commit 2fdc2449 authored by Amparo Luna's avatar Amparo Luna Committed by Mayra Cabrera

Add individual usage counters for snippet types

parent 7c065e6b
---
title: Add index on id and type for Snippets
merge_request: 32885
author:
type: performance
# frozen_string_literal: true
class AddIndexOnSnippetTypeAndId < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_index :snippets, [:id, :type]
end
def down
remove_concurrent_index :snippets, [:id, :type]
end
end
......@@ -10744,6 +10744,8 @@ CREATE INDEX index_snippets_on_description_trigram ON public.snippets USING gin
CREATE INDEX index_snippets_on_file_name_trigram ON public.snippets USING gin (file_name public.gin_trgm_ops);
CREATE INDEX index_snippets_on_id_and_type ON public.snippets USING btree (id, type);
CREATE INDEX index_snippets_on_project_id_and_visibility_level ON public.snippets USING btree (project_id, visibility_level);
CREATE INDEX index_snippets_on_title_trigram ON public.snippets USING gin (title public.gin_trgm_ops);
......@@ -14024,6 +14026,7 @@ COPY "schema_migrations" (version) FROM STDIN;
20200521225327
20200521225337
20200521225346
20200522235146
20200525114553
20200525121014
20200526000407
......
......@@ -133,6 +133,8 @@ module Gitlab
releases: count(Release),
remote_mirrors: count(RemoteMirror),
snippets: count(Snippet),
personal_snippets: count(PersonalSnippet),
project_snippets: count(ProjectSnippet),
suggestions: count(Suggestion),
terraform_reports: count(::Ci::JobArtifact.terraform_reports),
terraform_states: count(::Terraform::State),
......
......@@ -124,6 +124,8 @@ module UsageDataHelpers
releases
remote_mirrors
snippets
personal_snippets
project_snippets
suggestions
terraform_reports
terraform_states
......
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