Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
86174a1b
Commit
86174a1b
authored
Jun 11, 2020
by
Adam Hegyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize container repository query
parent
e7631cb4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
app/models/container_repository.rb
app/models/container_repository.rb
+7
-1
changelogs/unreleased/220209-optimize-container-repository-query.yml
...unreleased/220209-optimize-container-repository-query.yml
+5
-0
No files found.
app/models/container_repository.rb
View file @
86174a1b
...
@@ -16,7 +16,13 @@ class ContainerRepository < ApplicationRecord
...
@@ -16,7 +16,13 @@ class ContainerRepository < ApplicationRecord
scope
:ordered
,
->
{
order
(
:name
)
}
scope
:ordered
,
->
{
order
(
:name
)
}
scope
:with_api_entity_associations
,
->
{
preload
(
project:
[
:route
,
{
namespace: :route
}])
}
scope
:with_api_entity_associations
,
->
{
preload
(
project:
[
:route
,
{
namespace: :route
}])
}
scope
:for_group_and_its_subgroups
,
->
(
group
)
do
scope
:for_group_and_its_subgroups
,
->
(
group
)
do
where
(
project_id:
Project
.
for_group_and_its_subgroups
(
group
).
with_container_registry
.
select
(
:id
))
project_scope
=
Project
.
for_group_and_its_subgroups
(
group
)
.
with_container_registry
.
select
(
:id
)
ContainerRepository
.
joins
(
"INNER JOIN (
#{
project_scope
.
to_sql
}
) projects on projects.id=container_repositories.project_id"
)
end
end
scope
:search_by_name
,
->
(
query
)
{
fuzzy_search
(
query
,
[
:name
],
use_minimum_char_limit:
false
)
}
scope
:search_by_name
,
->
(
query
)
{
fuzzy_search
(
query
,
[
:name
],
use_minimum_char_limit:
false
)
}
...
...
changelogs/unreleased/220209-optimize-container-repository-query.yml
0 → 100644
View file @
86174a1b
---
title
:
Optimize container repository for groups query
merge_request
:
34364
author
:
type
:
performance
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment