diff options
author | Robert Speicher <robert@gitlab.com> | 2018-10-22 19:12:19 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2018-10-22 19:12:19 +0000 |
commit | 616b73f2e6ead6b1d6e6214646ce81f07f295399 (patch) | |
tree | 694cd80c8d62645395939641688bb8885d269904 /db | |
parent | d6be7ed79557ce31a5d0062ceea00c877157a6c7 (diff) | |
parent | 4b9c17f196bab6075563f62d01f9db65c1a0515c (diff) | |
download | gitlab-ce-616b73f2e6ead6b1d6e6214646ce81f07f295399.tar.gz |
Merge branch 'refactor-project-rename-repo' into 'master'
Move Project#rename_repo to a service class
See merge request gitlab-org/gitlab-ce!22419
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20161221153951_rename_reserved_project_names.rb | 6 | ||||
-rw-r--r-- | db/post_migrate/20170313133418_rename_more_reserved_project_names.rb | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/db/post_migrate/20161221153951_rename_reserved_project_names.rb b/db/post_migrate/20161221153951_rename_reserved_project_names.rb index 08d7f499eec..678876e886c 100644 --- a/db/post_migrate/20161221153951_rename_reserved_project_names.rb +++ b/db/post_migrate/20161221153951_rename_reserved_project_names.rb @@ -113,7 +113,9 @@ class RenameReservedProjectNames < ActiveRecord::Migration begin # Because project path update is quite complex operation we can't safely # copy-paste all code from GitLab. As exception we use Rails code here - project.rename_repo if rename_project_row(project, path) + if rename_project_row(project, path) + Projects::AfterRenameService.new(project).execute + end rescue Exception => e # rubocop: disable Lint/RescueException Rails.logger.error "Exception when renaming project #{id}: #{e.message}" end @@ -123,6 +125,6 @@ class RenameReservedProjectNames < ActiveRecord::Migration def rename_project_row(project, path) project.respond_to?(:update_attributes) && project.update(path: path) && - project.respond_to?(:rename_repo) + defined?(Projects::AfterRenameService) end end diff --git a/db/post_migrate/20170313133418_rename_more_reserved_project_names.rb b/db/post_migrate/20170313133418_rename_more_reserved_project_names.rb index 43a37667250..26a67b0f814 100644 --- a/db/post_migrate/20170313133418_rename_more_reserved_project_names.rb +++ b/db/post_migrate/20170313133418_rename_more_reserved_project_names.rb @@ -55,7 +55,9 @@ class RenameMoreReservedProjectNames < ActiveRecord::Migration begin # Because project path update is quite complex operation we can't safely # copy-paste all code from GitLab. As exception we use Rails code here - project.rename_repo if rename_project_row(project, path) + if rename_project_row(project, path) + Projects::AfterRenameService.new(project).execute + end rescue Exception => e # rubocop: disable Lint/RescueException Rails.logger.error "Exception when renaming project #{id}: #{e.message}" end @@ -65,6 +67,6 @@ class RenameMoreReservedProjectNames < ActiveRecord::Migration def rename_project_row(project, path) project.respond_to?(:update_attributes) && project.update(path: path) && - project.respond_to?(:rename_repo) + defined?(Projects::AfterRenameService) end end |