diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-22 21:10:55 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-22 21:10:55 +0300 |
commit | 57f6fa3cd786acb4ead4b7a2d3aa43b6c7abbc58 (patch) | |
tree | a0eea3428f23270d4d6f843e3459022f03243f16 /app/models/projects | |
parent | 232e7582b0e81e95bd721ad8094fcb50ecbc8a04 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/projects')
-rw-r--r-- | app/models/projects/repository_storage_move.rb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/app/models/projects/repository_storage_move.rb b/app/models/projects/repository_storage_move.rb new file mode 100644 index 00000000000..f4411e0b4fd --- /dev/null +++ b/app/models/projects/repository_storage_move.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +# Projects::RepositoryStorageMove are details of repository storage moves for a +# project. For example, moving a project to another gitaly node to help +# balance storage capacity. +module Projects + class RepositoryStorageMove < ApplicationRecord + extend ::Gitlab::Utils::Override + include RepositoryStorageMovable + + self.table_name = 'project_repository_storage_moves' + + belongs_to :container, class_name: 'Project', inverse_of: :repository_storage_moves, foreign_key: :project_id + alias_attribute :project, :container + scope :with_projects, -> { includes(container: :route) } + + override :update_repository_storage + def update_repository_storage(new_storage) + container.update_column(:repository_storage, new_storage) + end + + override :schedule_repository_storage_update_worker + def schedule_repository_storage_update_worker + Projects::UpdateRepositoryStorageWorker.perform_async( + project_id, + destination_storage_name, + id + ) + end + + private + + override :error_key + def error_key + :project + end + end +end |