diff --git a/models/forgejo_migrations/migrate.go b/models/forgejo_migrations/migrate.go index 7c295247c0..c1a654cbde 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 6300307a35..9c1382e0ac 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 }