diff --git a/models/consistency.go b/models/consistency.go index f037b0515704..896c07ab8d1e 100644 --- a/models/consistency.go +++ b/models/consistency.go @@ -302,7 +302,7 @@ func DeleteOrphanedIssues() error { // CountOrphanedObjects count subjects with have no existing refobject anymore func CountOrphanedObjects(subject, refobject, joinCond string) (int64, error) { return x.Table("`"+subject+"`"). - Join("LEFT", refobject, joinCond). + Join("LEFT", "`"+refobject+"`", joinCond). Where(builder.IsNull{"`" + refobject + "`.id"}). Count("id") }