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

20200616124338_add_plan_limits_for_max_size_per_artifact_type.rb « migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 28fadb495dde610284722ed687822c2ffbf36015 (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
40
41
42
43
44
45
46
47
48
# frozen_string_literal: true

class AddPlanLimitsForMaxSizePerArtifactType < ActiveRecord::Migration[6.0]
  DOWNTIME = false

  def change
    # We need to set the 20mb default for lsif for backward compatibility
    # See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/34767#note_371619075
    add_column :plan_limits, "ci_max_artifact_size_lsif", :integer, default: 20, null: false

    artifact_types.each do |type|
      add_column :plan_limits, "ci_max_artifact_size_#{type}", :integer, default: 0, null: false
    end
  end

  private

  def artifact_types
    # The list of artifact types (except lsif) from Ci::JobArtifact file_type enum as of this writing.
    # Intentionally duplicated so that the migration won't change behavior
    # if ever we remove or add more to the list later on.
    %w[
      archive
      metadata
      trace
      junit
      sast
      dependency_scanning
      container_scanning
      dast
      codequality
      license_management
      license_scanning
      performance
      metrics
      metrics_referee
      network_referee
      dotenv
      cobertura
      terraform
      accessibility
      cluster_applications
      secret_detection
      requirements
      coverage_fuzzing
    ]
  end
end