Merge 390bdedc6b into 6efdcaed86
This commit is contained in:
commit
b0647bbf8f
|
|
@ -186,6 +186,8 @@ var migrations = []Migration{
|
|||
NewMigration("add u2f", addU2FReg),
|
||||
// v66 -> v67
|
||||
NewMigration("add login source id column for public_key table", addLoginSourceIDToPublicKeyTable),
|
||||
// v67 -> v68
|
||||
NewMigration("clean unlinked webhook and hook_task", cleanUnlinkedWebhookAndHookTasks),
|
||||
}
|
||||
|
||||
// Migrate database to current version
|
||||
|
|
|
|||
18
models/migrations/v67.go
Normal file
18
models/migrations/v67.go
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright 2018 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 (
|
||||
"github.com/go-xorm/xorm"
|
||||
)
|
||||
|
||||
func cleanUnlinkedWebhookAndHookTasks(x *xorm.Engine) error {
|
||||
_, err := x.Exec(`DELETE FROM webhook WHERE repo_id NOT IN (SELECT id FROM repository);`)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = x.Exec(`DELETE FROM hook_task WHERE repo_id NOT IN (SELECT id FROM repository);`)
|
||||
return err
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user