Welcome to mirror list, hosted at ThFree Co, Russian Federation.

legacy_uploads_migrator.rb « background_migration « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a9d38a27e0c18fa48d9dbcf4d54bd0d66d7b7439 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

module Gitlab
  module BackgroundMigration
    # This migration takes all legacy uploads (that were uploaded using AttachmentUploader)
    # and migrate them to the new (FileUploader) location (=under projects).
    #
    # We have dependencies (uploaders) in this migration because extracting code would add a lot of complexity
    # and possible errors could appear as the logic in the uploaders is not trivial.
    #
    # This migration will be removed in 13.0 in order to get rid of a migration that depends on
    # the application code.
    class LegacyUploadsMigrator
      include Database::MigrationHelpers

      def perform(start_id, end_id)
        Upload.where(id: start_id..end_id, uploader: 'AttachmentUploader').find_each do |upload|
          LegacyUploadMover.new(upload).execute
        end
      end
    end
  end
end