mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-22 08:38:03 +01:00
Repair the count usage during the upgrading
As the count quota is against artifact rather than tag in 2.0, the count usage should be recalculated Signed-off-by: Wenkai Yin <yinw@vmware.com>
This commit is contained in:
parent
d6b32e19df
commit
a4a1913598
@ -98,6 +98,14 @@ FROM (
|
||||
) AS s
|
||||
WHERE artifact.digest=s.digest;
|
||||
|
||||
/*repair the count usage as we calculate the count quota against artifact rather than tag*/
|
||||
/*count=count-(tag count-artifact count)*/
|
||||
UPDATE quota_usage SET used=jsonb_set(used, '{count}', ((used->>'count')::int - (SELECT (
|
||||
SELECT COUNT (*) FROM tag
|
||||
JOIN artifact ON tag.artifact_id=artifact.id
|
||||
WHERE artifact.project_id=quota_usage.reference_id::int)-(
|
||||
SELECT COUNT (*) FROM artifact
|
||||
WHERE project_id=quota_usage.reference_id::int)))::text::jsonb);
|
||||
|
||||
/* artifact_reference records the child artifact referenced by parent artifact */
|
||||
CREATE TABLE artifact_reference
|
||||
|
@ -66,9 +66,6 @@ func Migrate(database *models.Database) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// update quota
|
||||
// TODO
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user