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
Léo-Paul Géneau
gitlab-ce
Commits
4d72ca39
Commit
4d72ca39
authored
Apr 13, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove the use of default scope for Builds
parent
234be12e
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
298 additions
and
315 deletions
+298
-315
app/models/ci/build.rb
app/models/ci/build.rb
+0
-11
db/schema.rb
db/schema.rb
+298
-304
No files found.
app/models/ci/build.rb
View file @
4d72ca39
...
@@ -37,8 +37,6 @@
...
@@ -37,8 +37,6 @@
module
Ci
module
Ci
class
Build
<
CommitStatus
class
Build
<
CommitStatus
LAZY_ATTRIBUTES
=
[
'trace'
]
belongs_to
:runner
,
class_name:
'Ci::Runner'
belongs_to
:runner
,
class_name:
'Ci::Runner'
belongs_to
:trigger_request
,
class_name:
'Ci::TriggerRequest'
belongs_to
:trigger_request
,
class_name:
'Ci::TriggerRequest'
belongs_to
:erased_by
,
class_name:
'User'
belongs_to
:erased_by
,
class_name:
'User'
...
@@ -56,20 +54,11 @@ module Ci
...
@@ -56,20 +54,11 @@ module Ci
acts_as_taggable
acts_as_taggable
# To prevent db load megabytes of data from trace
default_scope
->
{
select
(
Ci
::
Build
.
columns_without_lazy
)
}
before_destroy
{
project
}
before_destroy
{
project
}
after_create
:execute_hooks
after_create
:execute_hooks
class
<<
self
class
<<
self
def
columns_without_lazy
(
column_names
-
LAZY_ATTRIBUTES
).
map
do
|
column_name
|
"
#{
table_name
}
.
#{
column_name
}
"
end
end
def
last_month
def
last_month
where
(
'created_at > ?'
,
Date
.
today
-
1
.
month
)
where
(
'created_at > ?'
,
Date
.
today
-
1
.
month
)
end
end
...
...
db/schema.rb
View file @
4d72ca39
This diff is collapsed.
Click to expand it.
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