mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 11:28:24 +00:00 
			
		
		
		
	* Doctor: find IssueLabels without existing label * Repo Delete: delete labels & issue_labels too
This commit is contained in:
		| @@ -224,6 +224,24 @@ func DeleteOrphanedLabels() error { | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| // CountOrphanedIssueLabels return count of IssueLabels witch have no label behind anymore | ||||
| func CountOrphanedIssueLabels() (int64, error) { | ||||
| 	return x.Table("issue_label"). | ||||
| 		Join("LEFT", "label", "issue_label.label_id = label.id"). | ||||
| 		Where(builder.IsNull{"label.id"}).Count() | ||||
| } | ||||
|  | ||||
| // DeleteOrphanedIssueLabels delete IssueLabels witch have no label behind anymore | ||||
| func DeleteOrphanedIssueLabels() error { | ||||
|  | ||||
| 	_, err := x.In("id", builder.Select("issue_label.id").From("issue_label"). | ||||
| 		Join("LEFT", "label", "issue_label.label_id = label.id"). | ||||
| 		Where(builder.IsNull{"label.id"})). | ||||
| 		Delete(IssueLabel{}) | ||||
|  | ||||
| 	return err | ||||
| } | ||||
|  | ||||
| // CountOrphanedIssues count issues without a repo | ||||
| func CountOrphanedIssues() (int64, error) { | ||||
| 	return x.Table("issue"). | ||||
|   | ||||
		Reference in New Issue
	
	Block a user