This commit is contained in:
@@ -6,9 +6,9 @@ package v1_20
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models/migrations/base"
|
||||
"gitea.dev/models/migrations/migrationtest"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
base.MainTest(m)
|
||||
migrationtest.MainTest(m)
|
||||
}
|
||||
|
||||
@@ -3,11 +3,9 @@
|
||||
|
||||
package v1_20
|
||||
|
||||
import (
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
import "gitea.dev/models/db"
|
||||
|
||||
func AddNeedApprovalToActionRun(x *xorm.Engine) error {
|
||||
func AddNeedApprovalToActionRun(x db.EngineMigration) error {
|
||||
/*
|
||||
New index: TriggerUserID
|
||||
New fields: NeedApproval, ApprovedBy
|
||||
|
||||
@@ -6,13 +6,12 @@ package v1_20
|
||||
import (
|
||||
"context"
|
||||
|
||||
"code.gitea.io/gitea/models/migrations/base"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"gitea.dev/models/db"
|
||||
"gitea.dev/models/migrations/base"
|
||||
"gitea.dev/modules/setting"
|
||||
)
|
||||
|
||||
func RenameWebhookOrgToOwner(x *xorm.Engine) error {
|
||||
func RenameWebhookOrgToOwner(x db.EngineMigration) error {
|
||||
type Webhook struct {
|
||||
OrgID int64 `xorm:"INDEX"`
|
||||
}
|
||||
|
||||
@@ -3,11 +3,9 @@
|
||||
|
||||
package v1_20
|
||||
|
||||
import (
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
import "gitea.dev/models/db"
|
||||
|
||||
func AddNewColumnForProject(x *xorm.Engine) error {
|
||||
func AddNewColumnForProject(x db.EngineMigration) error {
|
||||
type Project struct {
|
||||
OwnerID int64 `xorm:"INDEX"`
|
||||
}
|
||||
|
||||
@@ -4,13 +4,12 @@
|
||||
package v1_20
|
||||
|
||||
import (
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"gitea.dev/models/db"
|
||||
"gitea.dev/modules/log"
|
||||
)
|
||||
|
||||
// FixIncorrectProjectType: set individual project's type from 3(TypeOrganization) to 1(TypeIndividual)
|
||||
func FixIncorrectProjectType(x *xorm.Engine) error {
|
||||
func FixIncorrectProjectType(x db.EngineMigration) error {
|
||||
type User struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
Type int
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
|
||||
package v1_20
|
||||
|
||||
import "xorm.io/xorm"
|
||||
import "gitea.dev/models/db"
|
||||
|
||||
func AddVersionToActionRunner(x *xorm.Engine) error {
|
||||
func AddVersionToActionRunner(x db.EngineMigration) error {
|
||||
type ActionRunner struct {
|
||||
Version string `xorm:"VARCHAR(64)"` // the version of act_runner
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
package v1_20
|
||||
|
||||
import (
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
"gitea.dev/models/db"
|
||||
"gitea.dev/modules/timeutil"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"xorm.io/xorm/schemas"
|
||||
)
|
||||
|
||||
@@ -40,6 +40,6 @@ func (a *Action) TableIndices() []*schemas.Index {
|
||||
return indices
|
||||
}
|
||||
|
||||
func ImproveActionTableIndices(x *xorm.Engine) error {
|
||||
func ImproveActionTableIndices(x db.EngineMigration) error {
|
||||
return x.Sync(new(Action))
|
||||
}
|
||||
|
||||
@@ -6,12 +6,11 @@ package v1_20
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"code.gitea.io/gitea/modules/json"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"gitea.dev/models/db"
|
||||
"gitea.dev/modules/json"
|
||||
)
|
||||
|
||||
func ChangeContainerMetadataMultiArch(x *xorm.Engine) error {
|
||||
func ChangeContainerMetadataMultiArch(x db.EngineMigration) error {
|
||||
sess := x.NewSession()
|
||||
defer sess.Close()
|
||||
|
||||
|
||||
@@ -4,12 +4,11 @@
|
||||
package v1_20
|
||||
|
||||
import (
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"gitea.dev/models/db"
|
||||
"gitea.dev/modules/log"
|
||||
)
|
||||
|
||||
func FixIncorrectOwnerTeamUnitAccessMode(x *xorm.Engine) error {
|
||||
func FixIncorrectOwnerTeamUnitAccessMode(x db.EngineMigration) error {
|
||||
type UnitType int
|
||||
type AccessMode int
|
||||
|
||||
|
||||
@@ -4,12 +4,11 @@
|
||||
package v1_20
|
||||
|
||||
import (
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"gitea.dev/models/db"
|
||||
"gitea.dev/modules/log"
|
||||
)
|
||||
|
||||
func FixIncorrectAdminTeamUnitAccessMode(x *xorm.Engine) error {
|
||||
func FixIncorrectAdminTeamUnitAccessMode(x db.EngineMigration) error {
|
||||
type UnitType int
|
||||
type AccessMode int
|
||||
|
||||
|
||||
@@ -4,12 +4,11 @@
|
||||
package v1_20
|
||||
|
||||
import (
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"gitea.dev/models/db"
|
||||
"gitea.dev/modules/log"
|
||||
)
|
||||
|
||||
func FixExternalTrackerAndExternalWikiAccessModeInOwnerAndAdminTeam(x *xorm.Engine) error {
|
||||
func FixExternalTrackerAndExternalWikiAccessModeInOwnerAndAdminTeam(x db.EngineMigration) error {
|
||||
type UnitType int
|
||||
type AccessMode int
|
||||
|
||||
|
||||
@@ -3,11 +3,9 @@
|
||||
|
||||
package v1_20
|
||||
|
||||
import (
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
import "gitea.dev/models/db"
|
||||
|
||||
func AddActionTaskOutputTable(x *xorm.Engine) error {
|
||||
func AddActionTaskOutputTable(x db.EngineMigration) error {
|
||||
type ActionTaskOutput struct {
|
||||
ID int64
|
||||
TaskID int64 `xorm:"INDEX UNIQUE(task_id_output_key)"`
|
||||
|
||||
@@ -4,12 +4,11 @@
|
||||
package v1_20
|
||||
|
||||
import (
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"gitea.dev/models/db"
|
||||
"gitea.dev/modules/timeutil"
|
||||
)
|
||||
|
||||
func AddArchivedUnixToRepository(x *xorm.Engine) error {
|
||||
func AddArchivedUnixToRepository(x db.EngineMigration) error {
|
||||
type Repository struct {
|
||||
ArchivedUnix timeutil.TimeStamp `xorm:"DEFAULT 0"`
|
||||
}
|
||||
|
||||
@@ -3,11 +3,9 @@
|
||||
|
||||
package v1_20
|
||||
|
||||
import (
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
import "gitea.dev/models/db"
|
||||
|
||||
func AddIsInternalColumnToPackage(x *xorm.Engine) error {
|
||||
func AddIsInternalColumnToPackage(x db.EngineMigration) error {
|
||||
type Package struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
OwnerID int64 `xorm:"UNIQUE(s) INDEX NOT NULL"`
|
||||
|
||||
@@ -4,12 +4,11 @@
|
||||
package v1_20
|
||||
|
||||
import (
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"gitea.dev/models/db"
|
||||
"gitea.dev/modules/timeutil"
|
||||
)
|
||||
|
||||
func CreateActionArtifactTable(x *xorm.Engine) error {
|
||||
func CreateActionArtifactTable(x db.EngineMigration) error {
|
||||
// ActionArtifact is a file that is stored in the artifact storage.
|
||||
type ActionArtifact struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
|
||||
@@ -3,11 +3,9 @@
|
||||
|
||||
package v1_20
|
||||
|
||||
import (
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
import "gitea.dev/models/db"
|
||||
|
||||
func AddPinOrderToIssue(x *xorm.Engine) error {
|
||||
func AddPinOrderToIssue(x db.EngineMigration) error {
|
||||
type Issue struct {
|
||||
PinOrder int `xorm:"DEFAULT 0"`
|
||||
}
|
||||
|
||||
@@ -7,9 +7,8 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"gitea.dev/models/db"
|
||||
"gitea.dev/modules/log"
|
||||
)
|
||||
|
||||
// unknownAccessTokenScope represents the scope for an access token that isn't
|
||||
@@ -319,7 +318,7 @@ type AccessToken struct {
|
||||
Scope string
|
||||
}
|
||||
|
||||
func ConvertScopedAccessTokens(x *xorm.Engine) error {
|
||||
func ConvertScopedAccessTokens(x db.EngineMigration) error {
|
||||
var tokens []*AccessToken
|
||||
|
||||
if err := x.Find(&tokens); err != nil {
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models/migrations/base"
|
||||
"gitea.dev/models/migrations/migrationtest"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
@@ -66,7 +66,7 @@ func Test_ConvertScopedAccessTokens(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
x, deferable := base.PrepareTestEnv(t, 0, new(AccessToken))
|
||||
x, deferable := migrationtest.PrepareTestEnv(t, 0, new(AccessToken))
|
||||
defer deferable()
|
||||
if x == nil || t.Failed() {
|
||||
t.Skip()
|
||||
|
||||
Reference in New Issue
Block a user