This commit is contained in:
@@ -6,9 +6,9 @@ package v1_18
|
||||
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_18
|
||||
|
||||
import (
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
import "gitea.dev/models/db"
|
||||
|
||||
func CreateUserBadgesTable(x *xorm.Engine) error {
|
||||
func CreateUserBadgesTable(x db.EngineMigration) error {
|
||||
type Badge struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
Description string
|
||||
|
||||
@@ -4,12 +4,11 @@
|
||||
package v1_18
|
||||
|
||||
import (
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"gitea.dev/models/db"
|
||||
"gitea.dev/modules/setting"
|
||||
)
|
||||
|
||||
func AlterPublicGPGKeyContentFieldsToMediumText(x *xorm.Engine) error {
|
||||
func AlterPublicGPGKeyContentFieldsToMediumText(x db.EngineMigration) error {
|
||||
sess := x.NewSession()
|
||||
defer sess.Close()
|
||||
if err := sess.Begin(); err != nil {
|
||||
|
||||
@@ -4,11 +4,12 @@
|
||||
package v1_18
|
||||
|
||||
import (
|
||||
"gitea.dev/models/db"
|
||||
|
||||
"xorm.io/builder"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func FixPackageSemverField(x *xorm.Engine) error {
|
||||
func FixPackageSemverField(x db.EngineMigration) error {
|
||||
_, err := x.Exec(builder.Update(builder.Eq{"semver_compatible": false}).From("`package`").Where(builder.In("`type`", "conan", "generic")))
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -4,9 +4,8 @@
|
||||
package v1_18
|
||||
|
||||
import (
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"gitea.dev/models/db"
|
||||
"gitea.dev/modules/timeutil"
|
||||
)
|
||||
|
||||
type SystemSetting struct {
|
||||
@@ -18,6 +17,6 @@ type SystemSetting struct {
|
||||
Updated timeutil.TimeStamp `xorm:"updated"`
|
||||
}
|
||||
|
||||
func CreateSystemSettingsTable(x *xorm.Engine) error {
|
||||
func CreateSystemSettingsTable(x db.EngineMigration) error {
|
||||
return x.Sync(new(SystemSetting))
|
||||
}
|
||||
|
||||
@@ -4,12 +4,11 @@
|
||||
package v1_18
|
||||
|
||||
import (
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"gitea.dev/models/db"
|
||||
"gitea.dev/modules/timeutil"
|
||||
)
|
||||
|
||||
func AddTeamInviteTable(x *xorm.Engine) error {
|
||||
func AddTeamInviteTable(x db.EngineMigration) error {
|
||||
type TeamInvite struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
Token string `xorm:"UNIQUE(token) INDEX NOT NULL DEFAULT ''"`
|
||||
|
||||
@@ -6,13 +6,13 @@ package v1_18
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"code.gitea.io/gitea/models/issues"
|
||||
"gitea.dev/models/db"
|
||||
"gitea.dev/models/issues"
|
||||
|
||||
"xorm.io/builder"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func UpdateOpenMilestoneCounts(x *xorm.Engine) error {
|
||||
func UpdateOpenMilestoneCounts(x db.EngineMigration) error {
|
||||
var openMilestoneIDs []int64
|
||||
err := x.Table("milestone").Select("id").Where(builder.Neq{"is_closed": 1}).Find(&openMilestoneIDs)
|
||||
if err != nil {
|
||||
|
||||
@@ -6,8 +6,8 @@ package v1_18
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models/issues"
|
||||
"code.gitea.io/gitea/models/migrations/base"
|
||||
"gitea.dev/models/issues"
|
||||
"gitea.dev/models/migrations/migrationtest"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
@@ -16,7 +16,7 @@ func Test_UpdateOpenMilestoneCounts(t *testing.T) {
|
||||
type ExpectedMilestone issues.Milestone
|
||||
|
||||
// Prepare and load the testing database
|
||||
x, deferable := base.PrepareTestEnv(t, 0, new(issues.Milestone), new(ExpectedMilestone), new(issues.Issue))
|
||||
x, deferable := migrationtest.PrepareTestEnv(t, 0, new(issues.Milestone), new(ExpectedMilestone), new(issues.Issue))
|
||||
defer deferable()
|
||||
if x == nil || t.Failed() {
|
||||
return
|
||||
|
||||
@@ -3,12 +3,10 @@
|
||||
|
||||
package v1_18
|
||||
|
||||
import (
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
import "gitea.dev/models/db"
|
||||
|
||||
// AddConfidentialColumnToOAuth2ApplicationTable: add ConfidentialClient column, setting existing rows to true
|
||||
func AddConfidentialClientColumnToOAuth2ApplicationTable(x *xorm.Engine) error {
|
||||
func AddConfidentialClientColumnToOAuth2ApplicationTable(x db.EngineMigration) error {
|
||||
type oauth2Application struct {
|
||||
ID int64
|
||||
ConfidentialClient bool `xorm:"NOT NULL DEFAULT TRUE"`
|
||||
|
||||
@@ -6,7 +6,7 @@ package v1_18
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models/migrations/base"
|
||||
"gitea.dev/models/migrations/migrationtest"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
@@ -18,7 +18,7 @@ func Test_AddConfidentialClientColumnToOAuth2ApplicationTable(t *testing.T) {
|
||||
}
|
||||
|
||||
// Prepare and load the testing database
|
||||
x, deferable := base.PrepareTestEnv(t, 0, new(oauth2Application))
|
||||
x, deferable := migrationtest.PrepareTestEnv(t, 0, new(oauth2Application))
|
||||
defer deferable()
|
||||
if x == nil || t.Failed() {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user