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

queue_batched_background_migration.template « templates « batched_background_migration « generators « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 886a3bd3116a1ebb67601d779f424df925b7648b (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

# See https://docs.gitlab.com/ee/development/database/batched_background_migrations.html
# for more information on when/how to queue batched background migrations

# Update below commented lines with appropriate values.

class <%= migration_class_name %> < Gitlab::Database::Migration[<%= Gitlab::Database::Migration.current_version %>]
  MIGRATION = "<%= class_name %>"
  # DELAY_INTERVAL = 2.minutes
  # BATCH_SIZE = <%= Gitlab::Database::Migrations::BatchedBackgroundMigrationHelpers::BATCH_SIZE %>
  # SUB_BATCH_SIZE = <%= Gitlab::Database::Migrations::BatchedBackgroundMigrationHelpers::SUB_BATCH_SIZE %>

  def up
    queue_batched_background_migration(
      MIGRATION,
      :<%= table_name %>,
      :<%= column_name %>,
      job_interval: DELAY_INTERVAL,
      queued_migration_version: '<%= migration_number %>',
      batch_size: BATCH_SIZE,
      sub_batch_size: SUB_BATCH_SIZE
    )
  end

  def down
    delete_batched_background_migration(MIGRATION, :<%= table_name.to_sym %>, :<%= column_name.to_sym %>, [])
  end
end