Commit 0a136b97 authored by Adam Hegyi's avatar Adam Hegyi

Merge branch '208887-optimize-project-counters-projects_with_repositories_enabled' into 'master'

Optimize project counters with repositories enabled counter

See merge request gitlab-org/gitlab!26698
parents 73c3d767 ee8d2e77
---
title: Optimize Project counters with respository enabled counter
merge_request: 26698
author:
type: performance
# frozen_string_literal: true
class AddIndexOnProjectIdAndRepositoryAccessLevelToProjectFeatures < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
INDEX_NAME = 'index_project_features_on_project_id_ral_20'
disable_ddl_transaction!
def up
add_concurrent_index :project_features, :project_id, where: 'repository_access_level = 20', name: INDEX_NAME
end
def down
remove_concurrent_index_by_name :project_features, INDEX_NAME
end
end
...@@ -3265,6 +3265,7 @@ ActiveRecord::Schema.define(version: 2020_03_09_195710) do ...@@ -3265,6 +3265,7 @@ ActiveRecord::Schema.define(version: 2020_03_09_195710) do
t.integer "forking_access_level" t.integer "forking_access_level"
t.index ["project_id"], name: "index_project_features_on_project_id", unique: true t.index ["project_id"], name: "index_project_features_on_project_id", unique: true
t.index ["project_id"], name: "index_project_features_on_project_id_bal_20", where: "(builds_access_level = 20)" t.index ["project_id"], name: "index_project_features_on_project_id_bal_20", where: "(builds_access_level = 20)"
t.index ["project_id"], name: "index_project_features_on_project_id_ral_20", where: "(repository_access_level = 20)"
end end
create_table "project_group_links", id: :serial, force: :cascade do |t| create_table "project_group_links", id: :serial, force: :cascade do |t|
......
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