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

20191213120427_fix_max_pages_size.rb « migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 498ea91b773ab4cd8a092771c979ac809f38ea30 (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 FixMaxPagesSize < ActiveRecord::Migration[5.2]
  DOWNTIME = false
  MAX_SIZE = 1.terabyte / 1.megabyte

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

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

  def down
    # no-op
  end
end