mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-22 10:15:35 +01:00
1f0c8289a5
fixes #20445 Refactor scan/base_controller.go Move MakeReportPlaceholder, GetReportPlaceholder, GetSummary to vul and sbom scanHandler Signed-off-by: stonezdj <stone.zhang@broadcom.com>
43 lines
1.3 KiB
SQL
43 lines
1.3 KiB
SQL
/*
|
|
table artifact:
|
|
id SERIAL PRIMARY KEY NOT NULL,
|
|
type varchar(255) NOT NULL,
|
|
media_type varchar(255) NOT NULL,
|
|
manifest_media_type varchar(255) NOT NULL,
|
|
artifact_type varchar(255) NOT NULL,
|
|
project_id int NOT NULL,
|
|
repository_id int NOT NULL,
|
|
repository_name varchar(255) NOT NULL,
|
|
digest varchar(255) NOT NULL,
|
|
size bigint,
|
|
push_time timestamp default CURRENT_TIMESTAMP,
|
|
pull_time timestamp,
|
|
extra_attrs text,
|
|
annotations jsonb,
|
|
CONSTRAINT unique_artifact UNIQUE (repository_id, digest)
|
|
*/
|
|
|
|
/*
|
|
Add new column artifact_type for artifact table to work with oci-spec v1.1.0 list referrer api
|
|
*/
|
|
ALTER TABLE artifact ADD COLUMN IF NOT EXISTS artifact_type varchar(255);
|
|
|
|
/*
|
|
set value for artifact_type
|
|
then set column artifact_type as not null
|
|
*/
|
|
UPDATE artifact SET artifact_type = media_type WHERE artifact_type IS NULL;
|
|
|
|
ALTER TABLE artifact ALTER COLUMN artifact_type SET NOT NULL;
|
|
|
|
CREATE TABLE IF NOT EXISTS sbom_report
|
|
(
|
|
id SERIAL PRIMARY KEY NOT NULL,
|
|
uuid VARCHAR(64) UNIQUE NOT NULL,
|
|
artifact_id INT NOT NULL,
|
|
registration_uuid VARCHAR(64) NOT NULL,
|
|
mime_type VARCHAR(256) NOT NULL,
|
|
media_type VARCHAR(256) NOT NULL,
|
|
report JSON,
|
|
UNIQUE(artifact_id, registration_uuid, mime_type, media_type)
|
|
); |