summaryrefslogtreecommitdiff
path: root/db/post_migrate/20190703185326_fix_wrong_pages_access_level.rb
blob: e5981956cf5a61524d2247c276f0efac70e84413 (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

class FixWrongPagesAccessLevel < ActiveRecord::Migration[5.1]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  MIGRATION = 'FixPagesAccessLevel'
  BATCH_SIZE = 20_000
  BATCH_TIME = 2.minutes

  disable_ddl_transaction!

  class ProjectFeature < ActiveRecord::Base
    include ::EachBatch

    self.table_name = 'project_features'
    self.inheritance_column = :_type_disabled
  end

  def up
    queue_background_migration_jobs_by_range_at_intervals(
      ProjectFeature,
      MIGRATION,
      BATCH_TIME,
      batch_size: BATCH_SIZE)
  end
end