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

20230712145926_drop_ci_build_trace_metadata_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: dad647246a57469f092e848aa80feb7a7bff15f5 (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 DropCiBuildTraceMetadataPartitionIdDefault < Gitlab::Database::Migration[2.1]
  include Gitlab::Database::MigrationHelpers::WraparoundAutovacuum

  enable_lock_retries!

  TABLE_NAME = :ci_build_trace_metadata
  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