Commit b88da39f authored by Jan Provaznik's avatar Jan Provaznik

Merge branch 'philipcunningham-add-branch-to-dast-profile-322526' into 'master'

Add branch_name to Dast::Profile

See merge request gitlab-org/gitlab!54891
parents d1b905d6 5e9541ee
---
title: Add branch_name to dast_profiles table
merge_request: 54891
author:
type: added
# frozen_string_literal: true
class AddBranchNameToDastProfile < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
with_lock_retries do
add_column :dast_profiles, :branch_name, :text
end
add_text_limit :dast_profiles, :branch_name, 255
end
def down
with_lock_retries do
remove_column :dast_profiles, :branch_name
end
end
end
1266bf92f23a42d96778bf546534882f03d2388f22640e4cfaa2a9a1aad19093
\ No newline at end of file
......@@ -11634,7 +11634,9 @@ CREATE TABLE dast_profiles (
updated_at timestamp with time zone NOT NULL,
name text NOT NULL,
description text NOT NULL,
branch_name text,
CONSTRAINT check_5fcf73bf61 CHECK ((char_length(name) <= 255)),
CONSTRAINT check_6c9d775949 CHECK ((char_length(branch_name) <= 255)),
CONSTRAINT check_c34e505c24 CHECK ((char_length(description) <= 255))
);
......@@ -10,6 +10,7 @@ module Dast
validates :description, length: { maximum: 255 }
validates :name, length: { maximum: 255 }, uniqueness: { scope: :project_id }, presence: true
validates :branch_name, length: { maximum: 255 }
validates :project_id, :dast_site_profile_id, :dast_scanner_profile_id, presence: true
validate :project_ids_match
......
......@@ -15,6 +15,7 @@ RSpec.describe Dast::Profile, type: :model do
it { is_expected.to be_valid }
it { is_expected.to validate_length_of(:name).is_at_most(255) }
it { is_expected.to validate_length_of(:description).is_at_most(255) }
it { is_expected.to validate_length_of(:branch_name).is_at_most(255) }
it { is_expected.to validate_uniqueness_of(:name).scoped_to(:project_id) }
it { is_expected.to validate_presence_of(:project_id) }
it { is_expected.to validate_presence_of(:dast_site_profile_id) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment