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
Boxiang Sun
gitlab-ce
Commits
666ddec9
Commit
666ddec9
authored
Oct 01, 2018
by
Mark Chao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Combine two updates in one query
parent
c4bcb3a9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
9 deletions
+3
-9
app/models/project.rb
app/models/project.rb
+3
-9
No files found.
app/models/project.rb
View file @
666ddec9
...
@@ -95,8 +95,7 @@ class Project < ActiveRecord::Base
...
@@ -95,8 +95,7 @@ class Project < ActiveRecord::Base
unless: :ci_cd_settings
,
unless: :ci_cd_settings
,
if:
proc
{
ProjectCiCdSetting
.
available?
}
if:
proc
{
ProjectCiCdSetting
.
available?
}
after_create
:set_last_activity_at
after_create
:set_timestamps_for_create
after_create
:set_last_repository_updated_at
after_update
:update_forks_visibility_level
after_update
:update_forks_visibility_level
before_destroy
:remove_private_deploy_keys
before_destroy
:remove_private_deploy_keys
...
@@ -2102,13 +2101,8 @@ class Project < ActiveRecord::Base
...
@@ -2102,13 +2101,8 @@ class Project < ActiveRecord::Base
gitlab_shell
.
exists?
(
repository_storage
,
"
#{
disk_path
}
.git"
)
gitlab_shell
.
exists?
(
repository_storage
,
"
#{
disk_path
}
.git"
)
end
end
# set last_activity_at to the same as created_at
def
set_timestamps_for_create
def
set_last_activity_at
update_columns
(
last_activity_at:
self
.
created_at
,
last_repository_updated_at:
self
.
created_at
)
update_column
(
:last_activity_at
,
self
.
created_at
)
end
def
set_last_repository_updated_at
update_column
(
:last_repository_updated_at
,
self
.
created_at
)
end
end
def
cross_namespace_reference?
(
from
)
def
cross_namespace_reference?
(
from
)
...
...
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