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

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

class MigrateDefaultDiffMaxPatchBytesToMinimum200kb < ActiveRecord::Migration[6.0]
  DOWNTIME = false
  MAX_SIZE = 200.kilobytes

  class ApplicationSetting < ActiveRecord::Base
    self.table_name = 'application_settings'
  end

  def up
    table = ApplicationSetting.arel_table
    ApplicationSetting.where(table[:diff_max_patch_bytes].lt(MAX_SIZE)).update_all(diff_max_patch_bytes: MAX_SIZE)
  end

  def down
    table = ApplicationSetting.arel_table
    ApplicationSetting.where(table[:diff_max_patch_bytes].eq(MAX_SIZE)).update_all(diff_max_patch_bytes: 100.kilobytes)
  end
end