mirror of https://github.com/go-gitea/gitea.git
[BugFix] Fix comment broken issue ref dependence (#12651)
* deleteIssuesByRepoID: delete related CommentTypeRemoveDependency & CommentTypeAddDependency comments too * Ignore ErrIssueNotExist on comment.LoadDepIssueDetails() * Add migration * Ignore 'dependent_issue_id = 0' case * exchange as per @lunny Co-authored-by: techknowlogick <techknowlogick@gitea.io>pull/12707/head
parent
42a5e39b3b
commit
6c5266c9ca
@ -0,0 +1,14 @@
|
||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func purgeInvalidDependenciesComments(x *xorm.Engine) error {
|
||||
_, err := x.Exec("DELETE FROM comment WHERE dependent_issue_id != 0 AND dependent_issue_id NOT IN (SELECT id FROM issue)")
|
||||
return err
|
||||
}
|
Loading…
Reference in New Issue