refactor(modelmigration): thread context through migration functions (#38758)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Copilot
2026-08-03 08:13:15 +00:00
committed by GitHub
co-authored by wxiaoguang
parent e23fe79e5e
commit ac49dbe1a2
304 changed files with 1070 additions and 449 deletions
+6 -2
View File
@@ -3,9 +3,13 @@
package v1_7
import "gitea.dev/modelmigration/base"
import (
"context"
func AddMustChangePassword(x base.EngineMigration) error {
"gitea.dev/modelmigration/base"
)
func AddMustChangePassword(_ context.Context, x base.EngineMigration) error {
// User see models/user.go
type User struct {
ID int64 `xorm:"pk autoincr"`
+6 -2
View File
@@ -3,9 +3,13 @@
package v1_7
import "gitea.dev/modelmigration/base"
import (
"context"
func AddApprovalWhitelistsToProtectedBranches(x base.EngineMigration) error {
"gitea.dev/modelmigration/base"
)
func AddApprovalWhitelistsToProtectedBranches(_ context.Context, x base.EngineMigration) error {
type ProtectedBranch struct {
ApprovalsWhitelistUserIDs []int64 `xorm:"JSON TEXT"`
ApprovalsWhitelistTeamIDs []int64 `xorm:"JSON TEXT"`
+3 -1
View File
@@ -4,12 +4,14 @@
package v1_7
import (
"context"
"gitea.dev/modelmigration/base"
"xorm.io/builder"
)
func ClearNonusedData(x base.EngineMigration) error {
func ClearNonusedData(_ context.Context, x base.EngineMigration) error {
condDelete := func(colName string) builder.Cond {
return builder.NotIn(colName, builder.Select("id").From("`user`"))
}