You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
needed to fix issue as described in go-gitea#10280
* rename check-db to check-db-version
* add check-db-consistency:
* find issues without existing repository
* find pulls without existing issues
* find tracked times without existing issues/pulls
* find labels without repository or org reference
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
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")
511
+
}
512
+
513
+
//find labels without existing repo or org
514
+
count, err:=models.CountOrphanedLabels()
515
+
iferr!=nil {
516
+
returnnil, err
517
+
}
518
+
ifcount>0 {
519
+
ifctx.Bool("fix") {
520
+
iferr=models.DeleteOrphanedLabels(); err!=nil {
521
+
returnnil, err
522
+
}
523
+
results=append(results, fmt.Sprintf("%d labels without existing repository/organisation deleted", count))
524
+
} else {
525
+
results=append(results, fmt.Sprintf("%d labels without existing repository/organisation", count))
526
+
}
527
+
}
528
+
529
+
//find issues without existing repository
530
+
count, err=models.CountOrphanedIssues()
531
+
iferr!=nil {
532
+
returnnil, err
533
+
}
534
+
ifcount>0 {
535
+
ifctx.Bool("fix") {
536
+
iferr=models.DeleteOrphanedIssues(); err!=nil {
537
+
returnnil, err
538
+
}
539
+
results=append(results, fmt.Sprintf("%d issues without existing repository deleted", count))
540
+
} else {
541
+
results=append(results, fmt.Sprintf("%d issues without existing repository", count))
0 commit comments