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

20200217091401_reschedule_link_lfs_objects.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a7d1b42ef7027e09a6e1a1bffd1a0fce1f44fc2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true

class RescheduleLinkLfsObjects < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false
  MIGRATION = 'LinkLfsObjects'
  BATCH_SIZE = 1_000

  disable_ddl_transaction!

  def up
    forks = Gitlab::BackgroundMigration::LinkLfsObjects::Project.with_non_existing_lfs_objects

    queue_background_migration_jobs_by_range_at_intervals(
      forks,
      MIGRATION,
      BackgroundMigrationWorker.minimum_interval,
      batch_size: BATCH_SIZE
    )
  end

  def down
    # No-op. No need to make this reversible. In case the jobs enqueued runs and
    # fails at some point, some records will be created. When rescheduled, those
    # records won't be re-created. It's also hard to track which records to clean
    # up if ever.
  end
end