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

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

class CreateDastProfiles < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  def up
    table_comment = { owner: 'group::dynamic analysis', description: 'Profile used to run a DAST on-demand scan' }

    create_table_with_constraints :dast_profiles, comment: table_comment.to_json do |t| # rubocop:disable Migration/AddLimitToTextColumns
      t.references :project, null: false, foreign_key: false, index: false
      t.references :dast_site_profile, null: false, foreign_key: { on_delete: :cascade }
      t.references :dast_scanner_profile, null: false, foreign_key: { on_delete: :cascade }

      t.timestamps_with_timezone

      # rubocop:disable Migration/AddLimitToTextColumns
      t.text :name, null: false
      t.text :description, null: false
      # rubocop:enable Migration/AddLimitToTextColumns

      t.index [:project_id, :name], unique: true

      t.text_limit :name, 255
      t.text_limit :description, 255
    end
  end

  def down
    with_lock_retries do
      drop_table :dast_profiles
    end
  end
end