mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-08 22:13:26 +09:00
refactor(modelmigration): thread context through migration functions (#38758)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -4,11 +4,13 @@
|
||||
package v1_9
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gitea.dev/modelmigration/base"
|
||||
"gitea.dev/modules/timeutil"
|
||||
)
|
||||
|
||||
func AddUploaderIDForAttachment(x base.EngineMigration) error {
|
||||
func AddUploaderIDForAttachment(_ context.Context, x base.EngineMigration) error {
|
||||
type Attachment struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
UUID string `xorm:"uuid UNIQUE"`
|
||||
|
||||
@@ -3,9 +3,13 @@
|
||||
|
||||
package v1_9
|
||||
|
||||
import "gitea.dev/modelmigration/base"
|
||||
import (
|
||||
"context"
|
||||
|
||||
func AddGPGKeyImport(x base.EngineMigration) error {
|
||||
"gitea.dev/modelmigration/base"
|
||||
)
|
||||
|
||||
func AddGPGKeyImport(_ context.Context, x base.EngineMigration) error {
|
||||
type GPGKeyImport struct {
|
||||
KeyID string `xorm:"pk CHAR(16) NOT NULL"`
|
||||
Content string `xorm:"TEXT NOT NULL"`
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
package v1_9
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"gitea.dev/modelmigration/base"
|
||||
@@ -12,7 +13,7 @@ import (
|
||||
"gitea.dev/modules/util"
|
||||
)
|
||||
|
||||
func HashAppToken(x base.EngineMigration) error {
|
||||
func HashAppToken(_ context.Context, x base.EngineMigration) error {
|
||||
// AccessToken see models/token.go
|
||||
type AccessToken struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
|
||||
@@ -3,9 +3,13 @@
|
||||
|
||||
package v1_9
|
||||
|
||||
import "gitea.dev/modelmigration/base"
|
||||
import (
|
||||
"context"
|
||||
|
||||
func AddHTTPMethodToWebhook(x base.EngineMigration) error {
|
||||
"gitea.dev/modelmigration/base"
|
||||
)
|
||||
|
||||
func AddHTTPMethodToWebhook(_ context.Context, x base.EngineMigration) error {
|
||||
type Webhook struct {
|
||||
HTTPMethod string `xorm:"http_method DEFAULT 'POST'"`
|
||||
}
|
||||
|
||||
@@ -3,9 +3,13 @@
|
||||
|
||||
package v1_9
|
||||
|
||||
import "gitea.dev/modelmigration/base"
|
||||
import (
|
||||
"context"
|
||||
|
||||
func AddAvatarFieldToRepository(x base.EngineMigration) error {
|
||||
"gitea.dev/modelmigration/base"
|
||||
)
|
||||
|
||||
func AddAvatarFieldToRepository(_ context.Context, x base.EngineMigration) error {
|
||||
type Repository struct {
|
||||
// ID(10-20)-md5(32) - must fit into 64 symbols
|
||||
Avatar string `xorm:"VARCHAR(64)"`
|
||||
|
||||
Reference in New Issue
Block a user