From a610e93cc9fc53e079cc0e643522728001d7ec41 Mon Sep 17 00:00:00 2001 From: JakobDev Date: Thu, 4 Apr 2024 10:40:25 +0200 Subject: [PATCH] Add fix and migration --- models/forgejo_migrations/migrate.go | 2 ++ models/repo/archive_download_count.go | 3 +++ 2 files changed, 5 insertions(+) diff --git a/models/forgejo_migrations/migrate.go b/models/forgejo_migrations/migrate.go index 7c295247c..c1a654cbd 100644 --- a/models/forgejo_migrations/migrate.go +++ b/models/forgejo_migrations/migrate.go @@ -58,6 +58,8 @@ var migrations = []*Migration{ NewMigration("Add the `apply_to_admins` column to the `protected_branch` table", forgejo_v1_22.AddApplyToAdminsSetting), // v9 -> v10 NewMigration("Add pronouns to user", forgejo_v1_22.AddPronounsToUser), + // v11 -> v12 + NewMigration("Add repo_archive_download_count table", forgejo_v1_22.AddRepoArchiveDownloadCount), } // GetCurrentDBVersion returns the current Forgejo database version. diff --git a/models/repo/archive_download_count.go b/models/repo/archive_download_count.go index 6300307a3..9c1382e0a 100644 --- a/models/repo/archive_download_count.go +++ b/models/repo/archive_download_count.go @@ -74,6 +74,9 @@ func GetArchiveDownloadCount(ctx context.Context, repoID, releaseID int64) (*api func GetArchiveDownloadCountForTagName(ctx context.Context, repoID int64, tagName string) (*api.TagArchiveDownloadCount, error) { release, err := GetRelease(ctx, repoID, tagName) if err != nil { + if IsErrReleaseNotExist(err) { + return new(api.TagArchiveDownloadCount), nil + } return nil, err }