Fix CountOrphanedLabels in orphan check (#20009)

gitea doctor --run check-db-consistency is currently broken due to an incorrect
and old use of Count() with a string.

Signed-off-by: Andrew Thornton <art27@cantab.net>
tokarchuk/v1.17
zeripath 2 years ago committed by GitHub
parent 1e9ad8eb21
commit 5d80feb5a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      models/issues/label.go

@ -733,7 +733,7 @@ func DeleteLabelsByRepoID(ctx context.Context, repoID int64) error {
// CountOrphanedLabels return count of labels witch are broken and not accessible via ui anymore // CountOrphanedLabels return count of labels witch are broken and not accessible via ui anymore
func CountOrphanedLabels() (int64, error) { func CountOrphanedLabels() (int64, error) {
noref, err := db.GetEngine(db.DefaultContext).Table("label").Where("repo_id=? AND org_id=?", 0, 0).Count("label.id") noref, err := db.GetEngine(db.DefaultContext).Table("label").Where("repo_id=? AND org_id=?", 0, 0).Count()
if err != nil { if err != nil {
return 0, err return 0, err
} }

Loading…
Cancel
Save