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

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

class AddNamespaceStorageForksCostFactorToApplicationSettings < Gitlab::Database::Migration[2.1]
  disable_ddl_transaction!

  CONSTRAINT_NAME = 'check_app_settings_namespace_storage_forks_cost_factor_range'

  def up
    with_lock_retries do
      add_column :application_settings, :namespace_storage_forks_cost_factor,
        :float, default: 1.0, null: false, if_not_exists: true
    end

    add_check_constraint :application_settings,
      'namespace_storage_forks_cost_factor >= 0 AND namespace_storage_forks_cost_factor <= 1',
      CONSTRAINT_NAME
  end

  def down
    remove_column :application_settings, :namespace_storage_forks_cost_factor
  end
end