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

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

class InitConversionForPCiBuildsForSelfHost < Gitlab::Database::Migration[2.2]
  include ::Gitlab::Database::SchemaHelpers

  milestone '16.6'
  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
  ]
  TRIGGER_NAME = :trigger_10ee1357e825

  def up
    return if should_skip?

    initialize_conversion_of_integer_to_bigint(TABLE_NAME, COLUMN_NAMES)
  end

  def down
    return unless should_skip?

    revert_initialize_conversion_of_integer_to_bigint(TABLE_NAME, COLUMN_NAMES)
  end

  private

  def should_skip?
    trigger_exists?(TABLE_NAME, TRIGGER_NAME)
  end
end