summaryrefslogtreecommitdiff
path: root/db/post_migrate/20210823113259_steal_merge_request_diff_commit_users_migration.rb
blob: 7e893d62c280172220225e9d2e09f6664dd7add9 (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
# frozen_string_literal: true

# See https://docs.gitlab.com/ee/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.

class StealMergeRequestDiffCommitUsersMigration < ActiveRecord::Migration[6.1]
  include Gitlab::Database::MigrationHelpers

  disable_ddl_transaction!

  def up
    job = Gitlab::Database::BackgroundMigrationJob
      .for_migration_class('MigrateMergeRequestDiffCommitUsers')
      .pending
      .last

    return unless job

    # We schedule in one hour so we don't end up running the migrations while a
    # deployment is still wrapping up. Not that that really matters, but it
    # prevents from too much happening during a deployment window.
    migrate_in(1.hour, 'StealMigrateMergeRequestDiffCommitUsers', job.arguments)
  end

  def down
    # no-op
  end
end