code.gitea.io/gitea@v1.21.7/models/migrations/v1_12/v129.go (about) 1 // Copyright 2020 The Gitea Authors. All rights reserved. 2 // SPDX-License-Identifier: MIT 3 4 package v1_12 //nolint 5 6 import ( 7 "xorm.io/xorm" 8 ) 9 10 func PurgeUnusedDependencies(x *xorm.Engine) error { 11 if _, err := x.Exec("DELETE FROM issue_dependency WHERE issue_id NOT IN (SELECT id FROM issue)"); err != nil { 12 return err 13 } 14 _, err := x.Exec("DELETE FROM issue_dependency WHERE dependency_id NOT IN (SELECT id FROM issue)") 15 return err 16 }