File tree 2 files changed +20
-0
lines changed
2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -190,6 +190,8 @@ var migrations = []Migration{
190
190
NewMigration ("add repository code language statistics" , addLanguageStats ),
191
191
// v128 -> v129
192
192
NewMigration ("fix merge base for pull requests" , fixMergeBase ),
193
+ // v129 -> v130
194
+ NewMigration ("remove dependencies from deleted repositories" , purgeUnusedDependencies ),
193
195
}
194
196
195
197
// Migrate database to current version
Original file line number Diff line number Diff line change
1
+ // Copyright 2020 The Gitea Authors. All rights reserved.
2
+ // Use of this source code is governed by a MIT-style
3
+ // license that can be found in the LICENSE file.
4
+
5
+ package migrations
6
+
7
+ import (
8
+ "xorm.io/xorm"
9
+ )
10
+
11
+ func purgeUnusedDependencies (x * xorm.Engine ) error {
12
+
13
+ if _ , err := x .Exec ("DELETE FROM issue_dependency WHERE issue_id NOT IN (SELECT id FROM issue)" ); err != nil {
14
+ return err
15
+ }
16
+ _ , err := x .Exec ("DELETE FROM issue_dependency WHERE dependency_id NOT IN (SELECT id FROM issue)" )
17
+ return err
18
+ }
You can’t perform that action at this time.
0 commit comments