Skip to content

Commit

Permalink
update artifact_type column alteration (goharbor#20239)
Browse files Browse the repository at this point in the history
update column if is null

Signed-off-by: yminer <yminer@vmware.com>
Co-authored-by: Wang Yan <wangyan@vmware.com>
Signed-off-by: wang yan <wangyan@vmware.com>
  • Loading branch information
MinerYang and wy65701436 committed Apr 9, 2024
1 parent 22912f6 commit b77930f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions make/migrations/postgresql/0140_2.11.0_schema.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ table artifact:
/*
Add new column artifact_type for artifact table to work with oci-spec v1.1.0 list referrer api
*/
ALTER TABLE artifact ADD COLUMN artifact_type varchar(255);
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;
UPDATE artifact SET artifact_type = media_type WHERE artifact_type IS NULL;

ALTER TABLE artifact ALTER COLUMN artifact_type SET NOT NULL;

0 comments on commit b77930f

Please sign in to comment.