This commit is contained in:
@@ -6,9 +6,9 @@ package v1_23
|
||||
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,9 +3,13 @@
|
||||
|
||||
package v1_23
|
||||
|
||||
import "xorm.io/xorm"
|
||||
import (
|
||||
"gitea.dev/models/db"
|
||||
|
||||
func AddContentVersionToIssueAndComment(x *xorm.Engine) error {
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func AddContentVersionToIssueAndComment(x db.EngineMigration) error {
|
||||
type Issue struct {
|
||||
ContentVersion int `xorm:"NOT NULL DEFAULT 0"`
|
||||
}
|
||||
|
||||
@@ -3,9 +3,13 @@
|
||||
|
||||
package v1_23
|
||||
|
||||
import "xorm.io/xorm"
|
||||
import (
|
||||
"gitea.dev/models/db"
|
||||
|
||||
func AddForcePushBranchProtection(x *xorm.Engine) error {
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func AddForcePushBranchProtection(x db.EngineMigration) error {
|
||||
type ProtectedBranch struct {
|
||||
CanForcePush bool `xorm:"NOT NULL DEFAULT false"`
|
||||
EnableForcePushAllowlist bool `xorm:"NOT NULL DEFAULT false"`
|
||||
|
||||
@@ -3,10 +3,14 @@
|
||||
|
||||
package v1_23
|
||||
|
||||
import "xorm.io/xorm"
|
||||
import (
|
||||
"gitea.dev/models/db"
|
||||
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
// AddSkipSeconderyAuthToOAuth2ApplicationTable: add SkipSecondaryAuthorization column, setting existing rows to false
|
||||
func AddSkipSecondaryAuthColumnToOAuth2ApplicationTable(x *xorm.Engine) error {
|
||||
func AddSkipSecondaryAuthColumnToOAuth2ApplicationTable(x db.EngineMigration) error {
|
||||
type oauth2Application struct {
|
||||
SkipSecondaryAuthorization bool `xorm:"NOT NULL DEFAULT FALSE"`
|
||||
}
|
||||
|
||||
@@ -4,12 +4,13 @@
|
||||
package v1_23
|
||||
|
||||
import (
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
"gitea.dev/models/db"
|
||||
"gitea.dev/modules/timeutil"
|
||||
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func AddIndexToActionTaskStoppedLogExpired(x *xorm.Engine) error {
|
||||
func AddIndexToActionTaskStoppedLogExpired(x db.EngineMigration) error {
|
||||
type ActionTask struct {
|
||||
Stopped timeutil.TimeStamp `xorm:"index(stopped_log_expired)"`
|
||||
LogExpired bool `xorm:"index(stopped_log_expired)"`
|
||||
|
||||
@@ -6,8 +6,8 @@ package v1_23
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models/migrations/base"
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
"gitea.dev/models/migrations/migrationtest"
|
||||
"gitea.dev/modules/timeutil"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
@@ -44,7 +44,7 @@ func Test_AddIndexToActionTaskStoppedLogExpired(t *testing.T) {
|
||||
}
|
||||
|
||||
// Prepare and load the testing database
|
||||
x, deferable := base.PrepareTestEnv(t, 0, new(ActionTask))
|
||||
x, deferable := migrationtest.PrepareTestEnv(t, 0, new(ActionTask))
|
||||
defer deferable()
|
||||
|
||||
assert.NoError(t, AddIndexToActionTaskStoppedLogExpired(x))
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
package v1_23
|
||||
|
||||
import (
|
||||
"gitea.dev/models/db"
|
||||
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
@@ -14,7 +16,7 @@ type CommentMetaData struct {
|
||||
ProjectTitle string `json:"project_title"`
|
||||
}
|
||||
|
||||
func AddCommentMetaDataColumn(x *xorm.Engine) error {
|
||||
func AddCommentMetaDataColumn(x db.EngineMigration) error {
|
||||
type Comment struct {
|
||||
CommentMetaData *CommentMetaData `xorm:"JSON TEXT"` // put all non-index metadata in a single field
|
||||
}
|
||||
|
||||
@@ -3,9 +3,13 @@
|
||||
|
||||
package v1_23
|
||||
|
||||
import "xorm.io/xorm"
|
||||
import (
|
||||
"gitea.dev/models/db"
|
||||
|
||||
func AddIndexForReleaseSha1(x *xorm.Engine) error {
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func AddIndexForReleaseSha1(x db.EngineMigration) error {
|
||||
type Release struct {
|
||||
Sha1 string `xorm:"INDEX VARCHAR(64)"`
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ package v1_23
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models/migrations/base"
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
"gitea.dev/models/migrations/migrationtest"
|
||||
"gitea.dev/modules/timeutil"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
@@ -33,7 +33,7 @@ func Test_AddIndexForReleaseSha1(t *testing.T) {
|
||||
}
|
||||
|
||||
// Prepare and load the testing database
|
||||
x, deferable := base.PrepareTestEnv(t, 0, new(Release))
|
||||
x, deferable := migrationtest.PrepareTestEnv(t, 0, new(Release))
|
||||
defer deferable()
|
||||
|
||||
assert.NoError(t, AddIndexForReleaseSha1(x))
|
||||
|
||||
@@ -4,12 +4,11 @@
|
||||
package v1_23
|
||||
|
||||
import (
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"gitea.dev/models/db"
|
||||
"gitea.dev/modules/timeutil"
|
||||
)
|
||||
|
||||
func AddRepositoryLicenses(x *xorm.Engine) error {
|
||||
func AddRepositoryLicenses(x db.EngineMigration) error {
|
||||
type RepoLicense struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
RepoID int64 `xorm:"UNIQUE(s) NOT NULL"`
|
||||
|
||||
@@ -3,9 +3,13 @@
|
||||
|
||||
package v1_23
|
||||
|
||||
import "xorm.io/xorm"
|
||||
import (
|
||||
"gitea.dev/models/db"
|
||||
|
||||
func AddBlockAdminMergeOverrideBranchProtection(x *xorm.Engine) error {
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func AddBlockAdminMergeOverrideBranchProtection(x db.EngineMigration) error {
|
||||
type ProtectedBranch struct {
|
||||
BlockAdminMergeOverride bool `xorm:"NOT NULL DEFAULT false"`
|
||||
}
|
||||
|
||||
@@ -4,12 +4,11 @@
|
||||
package v1_23
|
||||
|
||||
import (
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"gitea.dev/models/db"
|
||||
"gitea.dev/modules/timeutil"
|
||||
)
|
||||
|
||||
func FixMilestoneNoDueDate(x *xorm.Engine) error {
|
||||
func FixMilestoneNoDueDate(x db.EngineMigration) error {
|
||||
type Milestone struct {
|
||||
DeadlineUnix timeutil.TimeStamp
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
package v1_23
|
||||
|
||||
import (
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
"gitea.dev/models/db"
|
||||
"gitea.dev/modules/timeutil"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"xorm.io/xorm/schemas"
|
||||
)
|
||||
|
||||
@@ -47,6 +47,6 @@ func (a *improveActionTableIndicesAction) TableIndices() []*schemas.Index {
|
||||
return indices
|
||||
}
|
||||
|
||||
func AddNewIndexForUserDashboard(x *xorm.Engine) error {
|
||||
func AddNewIndexForUserDashboard(x db.EngineMigration) error {
|
||||
return x.Sync(new(improveActionTableIndicesAction))
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
package v1_23
|
||||
|
||||
import (
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
"gitea.dev/models/db"
|
||||
"gitea.dev/modules/timeutil"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"xorm.io/xorm/schemas"
|
||||
)
|
||||
|
||||
@@ -72,6 +72,6 @@ func (*improveNotificationTableIndicesAction) TableIndices() []*schemas.Index {
|
||||
return indices
|
||||
}
|
||||
|
||||
func ImproveNotificationTableIndices(x *xorm.Engine) error {
|
||||
func ImproveNotificationTableIndices(x db.EngineMigration) error {
|
||||
return x.Sync(&improveNotificationTableIndicesAction{})
|
||||
}
|
||||
|
||||
@@ -4,10 +4,12 @@
|
||||
package v1_23
|
||||
|
||||
import (
|
||||
"gitea.dev/models/db"
|
||||
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func AddPriorityToProtectedBranch(x *xorm.Engine) error {
|
||||
func AddPriorityToProtectedBranch(x db.EngineMigration) error {
|
||||
type ProtectedBranch struct {
|
||||
Priority int64 `xorm:"NOT NULL DEFAULT 0"`
|
||||
}
|
||||
|
||||
@@ -4,10 +4,12 @@
|
||||
package v1_23
|
||||
|
||||
import (
|
||||
"gitea.dev/models/db"
|
||||
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func AddTimeEstimateColumnToIssueTable(x *xorm.Engine) error {
|
||||
func AddTimeEstimateColumnToIssueTable(x db.EngineMigration) error {
|
||||
type Issue struct {
|
||||
TimeEstimate int64 `xorm:"NOT NULL DEFAULT 0"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user