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
b2cf4b95
Commit
b2cf4b95
authored
Dec 07, 2018
by
Rubén Dávila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backports some changes from gitlab-ee!7885
parent
a2e06ad3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
lib/api/namespaces.rb
lib/api/namespaces.rb
+16
-1
lib/gitlab/database/migration_helpers.rb
lib/gitlab/database/migration_helpers.rb
+2
-1
No files found.
lib/api/namespaces.rb
View file @
b2cf4b95
...
...
@@ -6,20 +6,35 @@ module API
before
{
authenticate!
}
helpers
do
params
:optional_list_params_ee
do
# EE::API::Namespaces would override this helper
end
# EE::API::Namespaces would override this method
def
custom_namespace_present_options
{}
end
end
resource
:namespaces
do
desc
'Get a namespaces list'
do
success
Entities
::
Namespace
end
params
do
optional
:search
,
type:
String
,
desc:
"Search query for namespaces"
use
:pagination
use
:optional_list_params_ee
end
get
do
namespaces
=
current_user
.
admin
?
Namespace
.
all
:
current_user
.
namespaces
namespaces
=
namespaces
.
search
(
params
[
:search
])
if
params
[
:search
].
present?
present
paginate
(
namespaces
),
with:
Entities
::
Namespace
,
current_user:
current_user
options
=
{
with:
Entities
::
Namespace
,
current_user:
current_user
}
present
paginate
(
namespaces
),
options
.
reverse_merge
(
custom_namespace_present_options
)
end
desc
'Get a namespace by ID'
do
...
...
lib/gitlab/database/migration_helpers.rb
View file @
b2cf4b95
...
...
@@ -975,9 +975,10 @@ into similar problems in the future (e.g. when new tables are created).
raise
"
#{
model_class
}
does not have an ID to use for batch ranges"
unless
model_class
.
column_names
.
include?
(
'id'
)
jobs
=
[]
table_name
=
model_class
.
quoted_table_name
model_class
.
each_batch
(
of:
batch_size
)
do
|
relation
|
start_id
,
end_id
=
relation
.
pluck
(
'MIN(id), MAX(id)'
).
first
start_id
,
end_id
=
relation
.
pluck
(
"MIN(
#{
table_name
}
.id), MAX(
#{
table_name
}
.id)"
).
first
if
jobs
.
length
>=
BACKGROUND_MIGRATION_JOB_BUFFER_SIZE
# Note: This code path generally only helps with many millions of rows
...
...
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