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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
660a9d33
Commit
660a9d33
authored
Feb 09, 2018
by
Greg Stark
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
revert to earlier coding using a hard coded UNION ALL instead of Gitlab::SQL::Union
parent
82f9c1c4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
6 deletions
+3
-6
app/models/ci/build.rb
app/models/ci/build.rb
+3
-6
No files found.
app/models/ci/build.rb
View file @
660a9d33
...
@@ -59,24 +59,21 @@ module Ci
...
@@ -59,24 +59,21 @@ module Ci
old
=
Ci
::
Build
.
select
(
:id
).
where
(
%q[artifacts_file <> '']
)
old
=
Ci
::
Build
.
select
(
:id
).
where
(
%q[artifacts_file <> '']
)
new
=
Ci
::
Build
.
select
(
:id
).
where
(
%q[(artifacts_file IS NULL OR artifacts_file = '') AND EXISTS (?)]
,
new
=
Ci
::
Build
.
select
(
:id
).
where
(
%q[(artifacts_file IS NULL OR artifacts_file = '') AND EXISTS (?)]
,
Ci
::
JobArtifact
.
select
(
1
).
where
(
'ci_builds.id = ci_job_artifacts.job_id'
))
Ci
::
JobArtifact
.
select
(
1
).
where
(
'ci_builds.id = ci_job_artifacts.job_id'
))
union
=
Gitlab
::
SQL
::
Union
.
new
([
old
,
new
],
remove_duplicates:
false
)
where
(
'ci_builds.id IN (? UNION ALL ?)'
,
old
,
new
)
where
(
%Q[ci_builds.id IN (
#{
union
.
to_sql
}
)]
)
# rubocop:disable GitlabSecurity/SqlInjection
end
end
scope
:with_artifacts_not_expired
,
->
()
do
scope
:with_artifacts_not_expired
,
->
()
do
old
=
Ci
::
Build
.
select
(
:id
).
where
(
%q[artifacts_file <> '' AND (artifacts_expire_at IS NULL OR artifacts_expire_at > ?)]
,
Time
.
now
)
old
=
Ci
::
Build
.
select
(
:id
).
where
(
%q[artifacts_file <> '' AND (artifacts_expire_at IS NULL OR artifacts_expire_at > ?)]
,
Time
.
now
)
new
=
Ci
::
Build
.
select
(
:id
).
where
(
%q[(artifacts_file IS NULL OR artifacts_file = '') AND EXISTS (?)]
,
new
=
Ci
::
Build
.
select
(
:id
).
where
(
%q[(artifacts_file IS NULL OR artifacts_file = '') AND EXISTS (?)]
,
Ci
::
JobArtifact
.
select
(
1
).
where
(
'ci_builds.id = ci_job_artifacts.job_id AND (expire_at IS NULL OR expire_at > ?)'
,
Time
.
now
))
Ci
::
JobArtifact
.
select
(
1
).
where
(
'ci_builds.id = ci_job_artifacts.job_id AND (expire_at IS NULL OR expire_at > ?)'
,
Time
.
now
))
union
=
Gitlab
::
SQL
::
Union
.
new
([
old
,
new
],
remove_duplicates:
false
)
where
(
'ci_builds.id IN (? UNION ALL ?)'
,
old
,
new
)
where
(
%Q[ci_builds.id IN (
#{
union
.
to_sql
}
)]
)
# rubocop:disable GitlabSecurity/SqlInjection
end
end
scope
:with_expired_artifacts
,
->
()
do
scope
:with_expired_artifacts
,
->
()
do
old
=
Ci
::
Build
.
select
(
:id
).
where
(
%q[artifacts_file <> '' AND artifacts_expire_at < ?]
,
Time
.
now
)
old
=
Ci
::
Build
.
select
(
:id
).
where
(
%q[artifacts_file <> '' AND artifacts_expire_at < ?]
,
Time
.
now
)
new
=
Ci
::
Build
.
select
(
:id
).
where
(
%q[(artifacts_file IS NULL OR artifacts_file = '') AND EXISTS (?)]
,
new
=
Ci
::
Build
.
select
(
:id
).
where
(
%q[(artifacts_file IS NULL OR artifacts_file = '') AND EXISTS (?)]
,
Ci
::
JobArtifact
.
select
(
1
).
where
(
'ci_builds.id = ci_job_artifacts.job_id AND expire_at < ?'
,
Time
.
now
))
Ci
::
JobArtifact
.
select
(
1
).
where
(
'ci_builds.id = ci_job_artifacts.job_id AND expire_at < ?'
,
Time
.
now
))
union
=
Gitlab
::
SQL
::
Union
.
new
([
old
,
new
],
remove_duplicates:
false
)
where
(
'ci_builds.id IN (? UNION ALL ?)'
,
old
,
new
)
where
(
%Q[ci_builds.id IN (
#{
union
.
to_sql
}
)]
)
# rubocop:disable GitlabSecurity/SqlInjection
end
end
scope
:last_month
,
->
()
{
where
(
'created_at > ?'
,
Date
.
today
-
1
.
month
)
}
scope
:last_month
,
->
()
{
where
(
'created_at > ?'
,
Date
.
today
-
1
.
month
)
}
...
...
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