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

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

class CreateScanResultPolicyViolations < Gitlab::Database::Migration[2.1]
  enable_lock_retries!

  def up
    create_table :scan_result_policy_violations do |t|
      t.bigint :scan_result_policy_id,
        index: false,
        null: false

      t.bigint :merge_request_id,
        index: { name: 'index_scan_result_policy_violations_on_merge_request_id' },
        null: false

      t.bigint :project_id,
        index: { name: 'index_scan_result_policy_violations_on_project_id' },
        null: false

      t.timestamps_with_timezone null: false
    end

    add_index(:scan_result_policy_violations,
      %i[scan_result_policy_id merge_request_id],
      unique: true,
      name: 'index_scan_result_policy_violations_on_policy_and_merge_request')
  end

  def down
    drop_table :scan_result_policy_violations
  end
end