mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-22 20:53:40 +09:00
refactor(modelmigration): thread context through migration functions (#38758)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -4,13 +4,14 @@
|
||||
package v1_8
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"gitea.dev/modelmigration/base"
|
||||
"gitea.dev/modules/timeutil"
|
||||
)
|
||||
|
||||
func AddPullRequestRebaseWithMerge(x base.EngineMigration) error {
|
||||
func AddPullRequestRebaseWithMerge(_ context.Context, x base.EngineMigration) error {
|
||||
// RepoUnit describes all units of a repository
|
||||
type RepoUnit struct {
|
||||
ID int64
|
||||
|
||||
@@ -3,9 +3,13 @@
|
||||
|
||||
package v1_8
|
||||
|
||||
import "gitea.dev/modelmigration/base"
|
||||
import (
|
||||
"context"
|
||||
|
||||
func AddUserDefaultTheme(x base.EngineMigration) error {
|
||||
"gitea.dev/modelmigration/base"
|
||||
)
|
||||
|
||||
func AddUserDefaultTheme(_ context.Context, x base.EngineMigration) error {
|
||||
type User struct {
|
||||
Theme string `xorm:"VARCHAR(30) NOT NULL DEFAULT ''"`
|
||||
}
|
||||
|
||||
@@ -4,10 +4,12 @@
|
||||
package v1_8
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gitea.dev/modelmigration/base"
|
||||
)
|
||||
|
||||
func RenameRepoIsBareToIsEmpty(x base.EngineMigration) error {
|
||||
func RenameRepoIsBareToIsEmpty(_ context.Context, x base.EngineMigration) error {
|
||||
type Repository struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
IsBare bool
|
||||
|
||||
@@ -4,11 +4,13 @@
|
||||
package v1_8
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gitea.dev/modelmigration/base"
|
||||
"gitea.dev/modules/setting"
|
||||
)
|
||||
|
||||
func AddCanCloseIssuesViaCommitInAnyBranch(x base.EngineMigration) error {
|
||||
func AddCanCloseIssuesViaCommitInAnyBranch(_ context.Context, x base.EngineMigration) error {
|
||||
type Repository struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
CloseIssuesViaCommitInAnyBranch bool `xorm:"NOT NULL DEFAULT false"`
|
||||
|
||||
@@ -3,9 +3,13 @@
|
||||
|
||||
package v1_8
|
||||
|
||||
import "gitea.dev/modelmigration/base"
|
||||
import (
|
||||
"context"
|
||||
|
||||
func AddIsLockedToIssues(x base.EngineMigration) error {
|
||||
"gitea.dev/modelmigration/base"
|
||||
)
|
||||
|
||||
func AddIsLockedToIssues(_ context.Context, x base.EngineMigration) error {
|
||||
// Issue see models/issue.go
|
||||
type Issue struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
package v1_8
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"gitea.dev/modelmigration/base"
|
||||
@@ -11,7 +12,7 @@ import (
|
||||
"xorm.io/xorm/schemas"
|
||||
)
|
||||
|
||||
func ChangeU2FCounterType(x base.EngineMigration) error {
|
||||
func ChangeU2FCounterType(_ context.Context, x base.EngineMigration) error {
|
||||
var err error
|
||||
|
||||
switch x.Dialect().URI().DBType {
|
||||
|
||||
Reference in New Issue
Block a user