Commit 8a2b97f7 authored by Steve Abrams's avatar Steve Abrams

Merge branch '335700-remove-null-constraint' into 'master'

Remove not_null constraint on project_fingerprint for `security_findings`

See merge request gitlab-org/gitlab!66194
parents 0c41323d 9515ded6
# frozen_string_literal: true
class RemoveNullConstraintFromSecurityFindings < ActiveRecord::Migration[6.1]
def up
change_column_null :security_findings, :project_fingerprint, true
end
def down
# no-op, it can not be reverted due to existing records that might not be valid
end
end
a97ac46a042b7f049f27db4f4916b8b0dbf527ba3c34fc9cc577da7807a88d32
\ No newline at end of file
......@@ -17896,7 +17896,7 @@ CREATE TABLE security_findings (
scanner_id bigint NOT NULL,
severity smallint NOT NULL,
confidence smallint NOT NULL,
project_fingerprint text NOT NULL,
project_fingerprint text,
deduplicated boolean DEFAULT false NOT NULL,
"position" integer,
uuid uuid,
......@@ -19,7 +19,6 @@ module Security
enum confidence: ::Enums::Vulnerability.confidence_levels, _prefix: :confidence
enum severity: ::Enums::Vulnerability.severity_levels, _prefix: :severity
validates :project_fingerprint, presence: true, length: { maximum: 40 }
validates :uuid, presence: true
scope :by_uuid, -> (uuids) { where(uuid: uuids) }
......
......@@ -15,8 +15,6 @@ RSpec.describe Security::Finding do
end
describe 'validations' do
it { is_expected.to validate_presence_of(:project_fingerprint) }
it { is_expected.to validate_length_of(:project_fingerprint).is_at_most(40) }
it { is_expected.to validate_presence_of(:uuid) }
end
......
......@@ -42,8 +42,6 @@ RSpec.describe Security::StoreFindingsMetadataService do
.and change { security_scan.findings.first&.severity }.to(security_finding_1.severity.to_s)
.and change { security_scan.findings.first&.confidence }.to(security_finding_1.confidence.to_s)
.and change { security_scan.findings.first&.uuid }.to(security_finding_1.uuid)
.and change { security_scan.findings.first&.project_fingerprint }.to(security_finding_1.project_fingerprint)
.and change { security_scan.findings.first&.uuid }.to(security_finding_1.uuid)
.and change { security_scan.findings.last&.uuid }.to(security_finding_2.uuid)
end
......
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