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

20230713100100_drop_ci_pipeline_variable_partition_id_default.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5ef3a2caa823badd7443b3b2188c240b31117439 (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
# frozen_string_literal: true

class DropCiPipelineVariablePartitionIdDefault < Gitlab::Database::Migration[2.1]
  include Gitlab::Database::MigrationHelpers::WraparoundAutovacuum

  enable_lock_retries!

  TABLE_NAME = :ci_pipeline_variables
  COLUMN_NAME = :partition_id

  def up
    change_column_default(TABLE_NAME, COLUMN_NAME, from: 100, to: nil) if should_run?
  end

  def down
    change_column_default(TABLE_NAME, COLUMN_NAME, from: nil, to: 100) if should_run?
  end

  private

  def should_run?
    can_execute_on?(TABLE_NAME)
  end
end