forked from forgejo/forgejo
Add index for hook_task table (#21545)
Since `hook_id` and `uuid` will become a search condition column. It's better to add some index for them.
This commit is contained in:
parent
e09025fdce
commit
f337c32e86
3 changed files with 28 additions and 7 deletions
|
@ -423,6 +423,8 @@ var migrations = []Migration{
|
|||
NewMigration("Update counts of all open milestones", updateOpenMilestoneCounts),
|
||||
// v230 -> v231
|
||||
NewMigration("Add ConfidentialClient column (default true) to OAuth2Application table", addConfidentialClientColumnToOAuth2ApplicationTable),
|
||||
// v231 -> v232
|
||||
NewMigration("Add index for hook_task", addIndexForHookTask),
|
||||
}
|
||||
|
||||
// GetCurrentDBVersion returns the current db version
|
||||
|
|
19
models/migrations/v231.go
Normal file
19
models/migrations/v231.go
Normal file
|
@ -0,0 +1,19 @@
|
|||
// Copyright 2022 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 addIndexForHookTask(x *xorm.Engine) error {
|
||||
type HookTask struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
HookID int64 `xorm:"index"`
|
||||
UUID string `xorm:"unique"`
|
||||
}
|
||||
|
||||
return x.Sync(new(HookTask))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue