Skip to content
Snippets Groups Projects
Commit 85236375 authored by Mark Chao's avatar Mark Chao
Browse files

Combine two updates in one query

parent 1a8bf70d
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -92,8 +92,7 @@ class Project < ActiveRecord::Base
unless: :ci_cd_settings,
if: proc { ProjectCiCdSetting.available? }
 
after_create :set_last_activity_at
after_create :set_last_repository_updated_at
after_create :set_timestamps_for_create
after_update :update_forks_visibility_level
 
before_destroy :remove_private_deploy_keys
Loading
Loading
@@ -2166,13 +2165,8 @@ class Project < ActiveRecord::Base
gitlab_shell.exists?(repository_storage, "#{disk_path}.git")
end
 
# set last_activity_at to the same as created_at
def set_last_activity_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)
def set_timestamps_for_create
update_columns(last_activity_at: self.created_at, last_repository_updated_at: self.created_at)
end
 
def cross_namespace_reference?(from)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment