Skip to content

Commit

Permalink
include count bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny committed Jun 3, 2022
1 parent f875e57 commit 905b0e7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions models/consistency.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ func DeleteOrphanedIssueLabels() error {
_, err := db.GetEngine(db.DefaultContext).
NotIn("label_id", builder.Select("id").From("label")).
Delete(IssueLabel{})

return err
}

Expand All @@ -95,7 +94,8 @@ func CountOrphanedIssues() (int64, error) {
return db.GetEngine(db.DefaultContext).Table("issue").
Join("LEFT", "repository", "issue.repo_id=repository.id").
Where(builder.IsNull{"repository.id"}).
Count("id")
Select("COUNT(`issue`.`id`)").
Count()
}

// DeleteOrphanedIssues delete issues without a repo
Expand Down Expand Up @@ -141,6 +141,7 @@ func CountOrphanedObjects(subject, refobject, joinCond string) (int64, error) {
return db.GetEngine(db.DefaultContext).Table("`"+subject+"`").
Join("LEFT", "`"+refobject+"`", joinCond).
Where(builder.IsNull{"`" + refobject + "`.id"}).
Select("COUNT(`" + subject + "`.`id`)").
Count()
}

Expand Down

0 comments on commit 905b0e7

Please sign in to comment.