Skip to content

Commit 905b0e7

Browse files
committed
include count bug fix
1 parent f875e57 commit 905b0e7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

models/consistency.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ func DeleteOrphanedIssueLabels() error {
8686
_, err := db.GetEngine(db.DefaultContext).
8787
NotIn("label_id", builder.Select("id").From("label")).
8888
Delete(IssueLabel{})
89-
9089
return err
9190
}
9291

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

101101
// DeleteOrphanedIssues delete issues without a repo
@@ -141,6 +141,7 @@ func CountOrphanedObjects(subject, refobject, joinCond string) (int64, error) {
141141
return db.GetEngine(db.DefaultContext).Table("`"+subject+"`").
142142
Join("LEFT", "`"+refobject+"`", joinCond).
143143
Where(builder.IsNull{"`" + refobject + "`.id"}).
144+
Select("COUNT(`" + subject + "`.`id`)").
144145
Count()
145146
}
146147

0 commit comments

Comments
 (0)