refactor: clean up comment model (#39779)

Try to figure out whether we can reuse the "comment" table for #36862

The legacy "CommitID" field is removed, and updated the comment.

Some useless and outdated "doctor fixes" are also removed together.
This commit is contained in:
wxiaoguang authored and GitHub committed 2026-10-14 19:55:30 +00:00
1 parent 919116568f
commit 1c117a9352
5 files changed
+90 -138

No files matched your search

+1 -23
View File
@@ -108,9 +108,8 @@ func prepareDBConsistencyChecks() []consistencyCheck {
// find tracked times without existing issues/pulls
genericOrphanCheck("Orphaned TrackedTimes without existing issue",
"tracked_time", "issue", "tracked_time.issue_id=issue.id"),
// find attachments without existing issues or releases
{
Name: "Orphaned Attachments without existing issues or releases",
Name: "Orphaned Attachments without existing issues, comments or releases",
Counter: repo_model.CountOrphanedAttachments,
Fixer: asFixer(repo_model.DeleteOrphanedAttachments),
},
@@ -121,27 +120,6 @@ func prepareDBConsistencyChecks() []consistencyCheck {
Fixer: repo_model.FixNullArchivedRepository,
FixedMessage: "Fixed",
},
// find label comments with empty labels
{
Name: "Label comments with empty labels",
Counter: issues_model.CountCommentTypeLabelWithEmptyLabel,
Fixer: issues_model.FixCommentTypeLabelWithEmptyLabel,
FixedMessage: "Fixed",
},
// find label comments with labels from outside the repository
{
Name: "Label comments with labels from outside the repository",
Counter: issues_model.CountCommentTypeLabelWithOutsideLabels,
Fixer: issues_model.FixCommentTypeLabelWithOutsideLabels,
FixedMessage: "Removed",
},
// find issue_label with labels from outside the repository
{
Name: "IssueLabels with Labels from outside the repository",
Counter: issues_model.CountIssueLabelWithOutsideLabels,
Fixer: issues_model.FixIssueLabelWithOutsideLabels,
FixedMessage: "Removed",
},
{
Name: "Action with created_unix set as an empty string",
Counter: activities_model.CountActionCreatedUnixString,