Commit 417ceae9 authored by Michael Kozono's avatar Michael Kozono

Merge branch '340440-add-jsonb-column-for-finding-evidence-data' into 'master'

Add jsonb field for Finding Evidence

See merge request gitlab-org/gitlab!70097
parents b20d0415 679ebf13
# frozen_string_literal: true
class AddDataToVulnerabilityFindingEvidence < Gitlab::Database::Migration[1.0]
def change
add_column :vulnerability_finding_evidences, :data, :jsonb, default: {}, null: false
end
end
1ad794ac96f6297203046562c2ec422fbb4d1818a65266bb92179096040f7d82
\ No newline at end of file
......@@ -20382,6 +20382,7 @@ CREATE TABLE vulnerability_finding_evidences (
updated_at timestamp with time zone NOT NULL,
vulnerability_occurrence_id bigint NOT NULL,
summary text,
data jsonb DEFAULT '{}'::jsonb NOT NULL,
CONSTRAINT check_5773b236fb CHECK ((char_length(summary) <= 8000000))
);
......@@ -33,6 +33,7 @@ module Vulnerabilities
foreign_key: 'vulnerability_finding_evidence_id'
validates :summary, length: { maximum: 8_000_000 }
validates :data, length: { maximum: 16_000_000 }, presence: true
end
end
end
......@@ -46,4 +46,6 @@ RSpec.describe Vulnerabilities::Finding::Evidence do
}
it { is_expected.to validate_length_of(:summary).is_at_most(8_000_000) }
it { is_expected.to validate_presence_of(:data) }
it { is_expected.to validate_length_of(:data).is_at_most(16_000_000) }
end
......@@ -204,7 +204,8 @@ RSpec.describe 'Database schema' do
"Operations::FeatureFlags::Strategy" => %w[parameters],
"Packages::Composer::Metadatum" => %w[composer_json],
"RawUsageData" => %w[payload], # Usage data payload changes often, we cannot use one schema
"Releases::Evidence" => %w[summary]
"Releases::Evidence" => %w[summary],
"Vulnerabilities::Finding::Evidence" => %w[data] # Validation work in progress
}.freeze
# We are skipping GEO models for now as it adds up complexity
......
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