returnnil,fmt.Errorf("model version on the database does not match the current Gitea version. Model consistency will not be checked until the database is upgraded")
}
//find labels without existing repo or org
count,err:=models.CountOrphanedLabels()
iferr!=nil{
returnnil,err
}
ifcount>0{
ifctx.Bool("fix"){
iferr=models.DeleteOrphanedLabels();err!=nil{
returnnil,err
}
results=append(results,fmt.Sprintf("%d labels without existing repository/organisation deleted",count))
}else{
results=append(results,fmt.Sprintf("%d labels without existing repository/organisation",count))
}
}
//find issues without existing repository
count,err=models.CountOrphanedIssues()
iferr!=nil{
returnnil,err
}
ifcount>0{
ifctx.Bool("fix"){
iferr=models.DeleteOrphanedIssues();err!=nil{
returnnil,err
}
results=append(results,fmt.Sprintf("%d issues without existing repository deleted",count))
}else{
results=append(results,fmt.Sprintf("%d issues without existing repository",count))