debian-mirror-gitlab/db/migrate/20210111051045_create_dast_profiles.rb

36 lines
1.1 KiB
Ruby
Raw Normal View History

2021-03-11 19:13:27 +05:30
# 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