2018-07-17 12:50:37 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-09-06 01:16:26 -04:00
|
|
|
module Projects
|
|
|
|
class HashedStorageMigrationService < BaseService
|
2017-11-13 09:15:42 -05:00
|
|
|
attr_reader :logger
|
2017-11-15 08:42:38 -05:00
|
|
|
|
2017-09-06 01:16:26 -04:00
|
|
|
def initialize(project, logger = nil)
|
|
|
|
@project = project
|
2017-11-13 09:15:42 -05:00
|
|
|
@logger = logger || Rails.logger
|
2017-09-06 01:16:26 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def execute
|
2017-11-13 09:15:42 -05:00
|
|
|
# Migrate repository from Legacy to Hashed Storage
|
|
|
|
unless project.hashed_storage?(:repository)
|
|
|
|
return unless HashedStorage::MigrateRepositoryService.new(project, logger).execute
|
2017-09-06 01:16:26 -04:00
|
|
|
end
|
2017-11-15 08:42:38 -05:00
|
|
|
|
|
|
|
# Migrate attachments from Legacy to Hashed Storage
|
|
|
|
unless project.hashed_storage?(:attachments)
|
|
|
|
HashedStorage::MigrateAttachmentsService.new(project, logger).execute
|
|
|
|
end
|
2017-09-06 01:16:26 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|