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

20231023083349_init_conversion_for_p_ci_builds.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 886e8c855998cad357688a76d4db65ddb76fb122 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
# frozen_string_literal: true

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

  disable_ddl_transaction!

  TABLE_NAME = :p_ci_builds
  COLUMN_NAMES = %i[
    auto_canceled_by_id
    commit_id
    erased_by_id
    project_id
    runner_id
    trigger_request_id
    upstream_pipeline_id
    user_id
  ]

  def up
    return if should_skip?

    initialize_conversion_of_integer_to_bigint(TABLE_NAME, COLUMN_NAMES)
  end

  def down
    return if should_skip?

    revert_initialize_conversion_of_integer_to_bigint(TABLE_NAME, COLUMN_NAMES)
  end

  private

  def should_skip?
    !can_execute_on?(TABLE_NAME)
  end
end