From 7b13bc0be5228c966017c7d0178e594207e871a3 Mon Sep 17 00:00:00 2001 From: Mithilesh Gupta Date: Thu, 30 Oct 2025 13:44:55 +0530 Subject: [PATCH 01/14] Added tests for v322 migration --- models/migrations/v1_25/v322_test.go | 41 ++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 models/migrations/v1_25/v322_test.go diff --git a/models/migrations/v1_25/v322_test.go b/models/migrations/v1_25/v322_test.go new file mode 100644 index 0000000000000..d014f4d9e4754 --- /dev/null +++ b/models/migrations/v1_25/v322_test.go @@ -0,0 +1,41 @@ +// Copyright 2025 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package v1_25 + +import ( + "testing" + + "code.gitea.io/gitea/models/migrations/base" + "code.gitea.io/gitea/modules/setting" + "github.com/stretchr/testify/assert" +) + +func Test_ExtendCommentTreePathLength(t *testing.T) { + if setting.Database.Type.IsSQLite3() { + t.Skip("For SQLITE, varchar or char will always be represented as TEXT") + } + + type Comment struct { + ID int64 `xorm:"pk autoincr"` + TreePath string `xorm:"VARCHAR(500)"` + } + + x, deferable := base.PrepareTestEnv(t, 0, new(Comment)) + defer deferable() + + assert.NoError(t, ExtendCommentTreePathLength(x)) + + tables, err := x.DBMetas() + assert.NoError(t, err) + + for _, table := range tables { + switch table.Name { + case "comment": + column := table.GetColumn("tree_path") + assert.NotNil(t, column) + assert.Equal(t, "VARCHAR", column.SQLType.Name) + assert.Equal(t, 4000, column.Length) + } + } +} From b753e7fba00a93c1b237e60b65ed811f97d1e9d6 Mon Sep 17 00:00:00 2001 From: Mithilesh Gupta Date: Thu, 30 Oct 2025 13:46:04 +0530 Subject: [PATCH 02/14] Modified tree length in test --- models/migrations/v1_25/v322_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/migrations/v1_25/v322_test.go b/models/migrations/v1_25/v322_test.go index d014f4d9e4754..0fe9bf12dd8c2 100644 --- a/models/migrations/v1_25/v322_test.go +++ b/models/migrations/v1_25/v322_test.go @@ -18,7 +18,7 @@ func Test_ExtendCommentTreePathLength(t *testing.T) { type Comment struct { ID int64 `xorm:"pk autoincr"` - TreePath string `xorm:"VARCHAR(500)"` + TreePath string `xorm:"VARCHAR(255)"` } x, deferable := base.PrepareTestEnv(t, 0, new(Comment)) From 796ea9a5157d763b538922ce61c2bef4b6f296b7 Mon Sep 17 00:00:00 2001 From: Mithilesh Gupta Date: Thu, 30 Oct 2025 13:59:50 +0530 Subject: [PATCH 03/14] Fixed formatting --- models/migrations/v1_25/v322_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/models/migrations/v1_25/v322_test.go b/models/migrations/v1_25/v322_test.go index 0fe9bf12dd8c2..cb25c81c51977 100644 --- a/models/migrations/v1_25/v322_test.go +++ b/models/migrations/v1_25/v322_test.go @@ -8,6 +8,7 @@ import ( "code.gitea.io/gitea/models/migrations/base" "code.gitea.io/gitea/modules/setting" + "github.com/stretchr/testify/assert" ) From 6a7f663cd45b5ad1b719297ff8d2d91178d42ade Mon Sep 17 00:00:00 2001 From: Mithilesh Gupta Date: Thu, 30 Oct 2025 14:10:32 +0530 Subject: [PATCH 04/14] Fixed MSSQL issues --- models/migrations/v1_25/v322_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/migrations/v1_25/v322_test.go b/models/migrations/v1_25/v322_test.go index cb25c81c51977..0a3b497945c20 100644 --- a/models/migrations/v1_25/v322_test.go +++ b/models/migrations/v1_25/v322_test.go @@ -35,8 +35,8 @@ func Test_ExtendCommentTreePathLength(t *testing.T) { case "comment": column := table.GetColumn("tree_path") assert.NotNil(t, column) - assert.Equal(t, "VARCHAR", column.SQLType.Name) - assert.Equal(t, 4000, column.Length) + assert.Contains(t, []string{"NVARCHAR", "VARCHAR"}, column.SQLType.Name) + assert.Equal(t, int64(4000), column.Length) } } } From 8654ab3b233f61985ca52027cf9e111e31eba952 Mon Sep 17 00:00:00 2001 From: Mithilesh Gupta Date: Thu, 30 Oct 2025 14:12:15 +0530 Subject: [PATCH 05/14] Explicit cast to int64 --- models/migrations/v1_25/v322_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/migrations/v1_25/v322_test.go b/models/migrations/v1_25/v322_test.go index 0a3b497945c20..b60f37c4b58ab 100644 --- a/models/migrations/v1_25/v322_test.go +++ b/models/migrations/v1_25/v322_test.go @@ -36,7 +36,7 @@ func Test_ExtendCommentTreePathLength(t *testing.T) { column := table.GetColumn("tree_path") assert.NotNil(t, column) assert.Contains(t, []string{"NVARCHAR", "VARCHAR"}, column.SQLType.Name) - assert.Equal(t, int64(4000), column.Length) + assert.Equal(t, int64(4000), int64(column.Length)) } } } From 897b8b87649bdb0a719d826bc0e355d9114b3d19 Mon Sep 17 00:00:00 2001 From: Mithilesh Gupta Date: Thu, 30 Oct 2025 14:22:17 +0530 Subject: [PATCH 06/14] Removed explicit type casting for column.Length --- models/migrations/v1_25/v322_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/migrations/v1_25/v322_test.go b/models/migrations/v1_25/v322_test.go index b60f37c4b58ab..0a3b497945c20 100644 --- a/models/migrations/v1_25/v322_test.go +++ b/models/migrations/v1_25/v322_test.go @@ -36,7 +36,7 @@ func Test_ExtendCommentTreePathLength(t *testing.T) { column := table.GetColumn("tree_path") assert.NotNil(t, column) assert.Contains(t, []string{"NVARCHAR", "VARCHAR"}, column.SQLType.Name) - assert.Equal(t, int64(4000), int64(column.Length)) + assert.Equal(t, int64(4000), column.Length) } } } From cc4dbd9e724d62f389cfd1fa05f92d435876ddf9 Mon Sep 17 00:00:00 2001 From: Mithilesh Gupta Date: Thu, 30 Oct 2025 15:15:31 +0530 Subject: [PATCH 07/14] Use TEXT instead of LONGTEXT for Notice.Description --- models/migrations/v1_25/v321_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/migrations/v1_25/v321_test.go b/models/migrations/v1_25/v321_test.go index 4897783fd3b1f..8c41c5a9ac909 100644 --- a/models/migrations/v1_25/v321_test.go +++ b/models/migrations/v1_25/v321_test.go @@ -38,7 +38,7 @@ func Test_UseLongTextInSomeColumnsAndFixBugs(t *testing.T) { type Notice struct { ID int64 `xorm:"pk autoincr"` Type int - Description string `xorm:"LONGTEXT"` + Description string `xorm:"TEXT"` CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"` } From 15697dcb83a23d34b35d7b3fc7785e1db7e47cbe Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 30 Oct 2025 18:15:20 +0800 Subject: [PATCH 08/14] fix more --- models/migrations/migrations.go | 5 ++- models/migrations/v1_25/v321_test.go | 39 +++++++++++----------- models/migrations/v1_25/v322_test.go | 25 ++++++-------- models/migrations/v1_26/main_test.go | 14 ++++++++ models/migrations/{v1_25 => v1_26}/v323.go | 2 +- 5 files changed, 49 insertions(+), 36 deletions(-) create mode 100644 models/migrations/v1_26/main_test.go rename models/migrations/{v1_25 => v1_26}/v323.go (98%) diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go index 8fb10e84cf68e..9516b51c79647 100644 --- a/models/migrations/migrations.go +++ b/models/migrations/migrations.go @@ -25,6 +25,7 @@ import ( "code.gitea.io/gitea/models/migrations/v1_23" "code.gitea.io/gitea/models/migrations/v1_24" "code.gitea.io/gitea/models/migrations/v1_25" + "code.gitea.io/gitea/models/migrations/v1_26" "code.gitea.io/gitea/models/migrations/v1_6" "code.gitea.io/gitea/models/migrations/v1_7" "code.gitea.io/gitea/models/migrations/v1_8" @@ -394,7 +395,9 @@ func prepareMigrationTasks() []*migration { // Gitea 1.24.0 ends at database version 321 newMigration(321, "Use LONGTEXT for some columns and fix review_state.updated_files column", v1_25.UseLongTextInSomeColumnsAndFixBugs), newMigration(322, "Extend comment tree_path length limit", v1_25.ExtendCommentTreePathLength), - newMigration(323, "Add support for actions concurrency", v1_25.AddActionsConcurrency), + + // Gitea 1.25.0 ends at migration ID number 322 (database version 323) + newMigration(323, "Add support for actions concurrency", v1_26.AddActionsConcurrency), } return preparedMigrations } diff --git a/models/migrations/v1_25/v321_test.go b/models/migrations/v1_25/v321_test.go index 8c41c5a9ac909..f7c85f5df2252 100644 --- a/models/migrations/v1_25/v321_test.go +++ b/models/migrations/v1_25/v321_test.go @@ -11,6 +11,7 @@ import ( "code.gitea.io/gitea/modules/timeutil" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func Test_UseLongTextInSomeColumnsAndFixBugs(t *testing.T) { @@ -43,28 +44,26 @@ func Test_UseLongTextInSomeColumnsAndFixBugs(t *testing.T) { } // Prepare and load the testing database - x, deferable := base.PrepareTestEnv(t, 0, new(ReviewState), new(PackageProperty), new(Notice)) - defer deferable() + x, deferrable := base.PrepareTestEnv(t, 0, new(ReviewState), new(PackageProperty), new(Notice)) + defer deferrable() assert.NoError(t, UseLongTextInSomeColumnsAndFixBugs(x)) - tables, err := x.DBMetas() - assert.NoError(t, err) + table, err := x.TableInfo("review_state") + require.NoError(t, err) + column := table.GetColumn("updated_files") + require.NotNil(t, column) + assert.Equal(t, "LONGTEXT", column.SQLType.Name) - for _, table := range tables { - switch table.Name { - case "review_state": - column := table.GetColumn("updated_files") - assert.NotNil(t, column) - assert.Equal(t, "LONGTEXT", column.SQLType.Name) - case "package_property": - column := table.GetColumn("value") - assert.NotNil(t, column) - assert.Equal(t, "LONGTEXT", column.SQLType.Name) - case "notice": - column := table.GetColumn("description") - assert.NotNil(t, column) - assert.Equal(t, "LONGTEXT", column.SQLType.Name) - } - } + table, err = x.TableInfo("package_property") + require.NoError(t, err) + column = table.GetColumn("value") + require.NotNil(t, column) + assert.Equal(t, "LONGTEXT", column.SQLType.Name) + + table, err = x.TableInfo("notice") + require.NoError(t, err) + column = table.GetColumn("description") + require.NotNil(t, column) + assert.Equal(t, "LONGTEXT", column.SQLType.Name) } diff --git a/models/migrations/v1_25/v322_test.go b/models/migrations/v1_25/v322_test.go index 0a3b497945c20..b16406d65d5fb 100644 --- a/models/migrations/v1_25/v322_test.go +++ b/models/migrations/v1_25/v322_test.go @@ -10,6 +10,7 @@ import ( "code.gitea.io/gitea/modules/setting" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func Test_ExtendCommentTreePathLength(t *testing.T) { @@ -22,21 +23,17 @@ func Test_ExtendCommentTreePathLength(t *testing.T) { TreePath string `xorm:"VARCHAR(255)"` } - x, deferable := base.PrepareTestEnv(t, 0, new(Comment)) - defer deferable() + x, deferrable := base.PrepareTestEnv(t, 0, new(Comment)) + defer deferrable() - assert.NoError(t, ExtendCommentTreePathLength(x)) + require.NoError(t, ExtendCommentTreePathLength(x)) - tables, err := x.DBMetas() - assert.NoError(t, err) + table, err := x.TableInfo("comment") + require.NoError(t, err) - for _, table := range tables { - switch table.Name { - case "comment": - column := table.GetColumn("tree_path") - assert.NotNil(t, column) - assert.Contains(t, []string{"NVARCHAR", "VARCHAR"}, column.SQLType.Name) - assert.Equal(t, int64(4000), column.Length) - } - } + column := table.GetColumn("tree_path") + require.NotNil(t, column) + + assert.Contains(t, []string{"NVARCHAR", "VARCHAR"}, column.SQLType.Name) + assert.EqualValues(t, 4000, column.Length) } diff --git a/models/migrations/v1_26/main_test.go b/models/migrations/v1_26/main_test.go new file mode 100644 index 0000000000000..5aa12d553c9f8 --- /dev/null +++ b/models/migrations/v1_26/main_test.go @@ -0,0 +1,14 @@ +// Copyright 2025 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package v1_26 + +import ( + "testing" + + "code.gitea.io/gitea/models/migrations/base" +) + +func TestMain(m *testing.M) { + base.MainTest(m) +} diff --git a/models/migrations/v1_25/v323.go b/models/migrations/v1_26/v323.go similarity index 98% rename from models/migrations/v1_25/v323.go rename to models/migrations/v1_26/v323.go index 5f38ea85458d2..b116f73bf0e04 100644 --- a/models/migrations/v1_25/v323.go +++ b/models/migrations/v1_26/v323.go @@ -1,7 +1,7 @@ // Copyright 2025 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_25 +package v1_26 import ( "xorm.io/xorm" From 306a96e61b0d143c77f946f5e278899fc8231667 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 30 Oct 2025 18:19:17 +0800 Subject: [PATCH 09/14] reformat comment --- models/migrations/migrations.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go index 9516b51c79647..e8ebb5df43ce1 100644 --- a/models/migrations/migrations.go +++ b/models/migrations/migrations.go @@ -380,8 +380,8 @@ func prepareMigrationTasks() []*migration { newMigration(309, "Improve Notification table indices", v1_23.ImproveNotificationTableIndices), newMigration(310, "Add Priority to ProtectedBranch", v1_23.AddPriorityToProtectedBranch), newMigration(311, "Add TimeEstimate to Issue table", v1_23.AddTimeEstimateColumnToIssueTable), - // Gitea 1.23.0-rc0 ends at migration ID number 311 (database version 312) + newMigration(312, "Add DeleteBranchAfterMerge to AutoMerge", v1_24.AddDeleteBranchAfterMergeForAutoMerge), newMigration(313, "Move PinOrder from issue table to a new table issue_pin", v1_24.MovePinOrderToTableIssuePin), newMigration(314, "Update OwnerID as zero for repository level action tables", v1_24.UpdateOwnerIDOfRepoLevelActionsTables), @@ -391,12 +391,12 @@ func prepareMigrationTasks() []*migration { newMigration(318, "Add anonymous_access_mode for repo_unit", v1_24.AddRepoUnitAnonymousAccessMode), newMigration(319, "Add ExclusiveOrder to Label table", v1_24.AddExclusiveOrderColumnToLabelTable), newMigration(320, "Migrate two_factor_policy to login_source table", v1_24.MigrateSkipTwoFactor), + // Gitea 1.24.0 ends at migration ID number 320 (database version 321) - // Gitea 1.24.0 ends at database version 321 newMigration(321, "Use LONGTEXT for some columns and fix review_state.updated_files column", v1_25.UseLongTextInSomeColumnsAndFixBugs), newMigration(322, "Extend comment tree_path length limit", v1_25.ExtendCommentTreePathLength), - // Gitea 1.25.0 ends at migration ID number 322 (database version 323) + newMigration(323, "Add support for actions concurrency", v1_26.AddActionsConcurrency), } return preparedMigrations From 3cdc0336cc915c49dd42ddca76fad465a35dff50 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 30 Oct 2025 19:03:06 +0800 Subject: [PATCH 10/14] fix test --- models/migrations/v1_25/v321_test.go | 6 +++--- models/migrations/v1_25/v322_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/models/migrations/v1_25/v321_test.go b/models/migrations/v1_25/v321_test.go index f7c85f5df2252..e9db720008618 100644 --- a/models/migrations/v1_25/v321_test.go +++ b/models/migrations/v1_25/v321_test.go @@ -49,19 +49,19 @@ func Test_UseLongTextInSomeColumnsAndFixBugs(t *testing.T) { assert.NoError(t, UseLongTextInSomeColumnsAndFixBugs(x)) - table, err := x.TableInfo("review_state") + table, err := x.TableInfo(new(ReviewState)) require.NoError(t, err) column := table.GetColumn("updated_files") require.NotNil(t, column) assert.Equal(t, "LONGTEXT", column.SQLType.Name) - table, err = x.TableInfo("package_property") + table, err = x.TableInfo(new(PackageProperty)) require.NoError(t, err) column = table.GetColumn("value") require.NotNil(t, column) assert.Equal(t, "LONGTEXT", column.SQLType.Name) - table, err = x.TableInfo("notice") + table, err = x.TableInfo(new(Notice)) require.NoError(t, err) column = table.GetColumn("description") require.NotNil(t, column) diff --git a/models/migrations/v1_25/v322_test.go b/models/migrations/v1_25/v322_test.go index b16406d65d5fb..85bf1949b29f1 100644 --- a/models/migrations/v1_25/v322_test.go +++ b/models/migrations/v1_25/v322_test.go @@ -28,7 +28,7 @@ func Test_ExtendCommentTreePathLength(t *testing.T) { require.NoError(t, ExtendCommentTreePathLength(x)) - table, err := x.TableInfo("comment") + table, err := x.TableInfo(new(Comment)) require.NoError(t, err) column := table.GetColumn("tree_path") From 2e04f7338ddbb35302ec3211e70753f8a4018b40 Mon Sep 17 00:00:00 2001 From: Mithilesh Gupta Date: Thu, 30 Oct 2025 16:40:28 +0530 Subject: [PATCH 11/14] Fixed ci issue --- models/migrations/v1_25/v322_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/migrations/v1_25/v322_test.go b/models/migrations/v1_25/v322_test.go index 85bf1949b29f1..690869a3c13ce 100644 --- a/models/migrations/v1_25/v322_test.go +++ b/models/migrations/v1_25/v322_test.go @@ -35,5 +35,5 @@ func Test_ExtendCommentTreePathLength(t *testing.T) { require.NotNil(t, column) assert.Contains(t, []string{"NVARCHAR", "VARCHAR"}, column.SQLType.Name) - assert.EqualValues(t, 4000, column.Length) + assert.EqualValues(t, int64(4000), column.Length) } From 9b44ed878b6c2d4456f30f59b058d903ada06cc0 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 30 Oct 2025 19:17:23 +0800 Subject: [PATCH 12/14] fix test --- models/migrations/base/tests.go | 11 +++++++++++ models/migrations/v1_25/v321_test.go | 14 ++++---------- models/migrations/v1_25/v322_test.go | 9 +-------- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/models/migrations/base/tests.go b/models/migrations/base/tests.go index 3b52a5e7c726f..83beca8fb9df7 100644 --- a/models/migrations/base/tests.go +++ b/models/migrations/base/tests.go @@ -19,6 +19,7 @@ import ( "github.com/stretchr/testify/require" "xorm.io/xorm" + "xorm.io/xorm/schemas" ) // FIXME: this file shouldn't be in a normal package, it should only be compiled for tests @@ -88,6 +89,16 @@ func PrepareTestEnv(t *testing.T, skip int, syncModels ...any) (*xorm.Engine, fu return x, deferFn } +func LoadTableSchemasMap(t *testing.T, x *xorm.Engine) map[string]*schemas.Table { + tables, err := x.DBMetas() + require.NoError(t, err) + tableMap := make(map[string]*schemas.Table) + for _, table := range tables { + tableMap[table.Name] = table + } + return tableMap +} + func MainTest(m *testing.M) { testlogger.Init() diff --git a/models/migrations/v1_25/v321_test.go b/models/migrations/v1_25/v321_test.go index e9db720008618..23dd7e54a1379 100644 --- a/models/migrations/v1_25/v321_test.go +++ b/models/migrations/v1_25/v321_test.go @@ -11,7 +11,6 @@ import ( "code.gitea.io/gitea/modules/timeutil" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func Test_UseLongTextInSomeColumnsAndFixBugs(t *testing.T) { @@ -49,21 +48,16 @@ func Test_UseLongTextInSomeColumnsAndFixBugs(t *testing.T) { assert.NoError(t, UseLongTextInSomeColumnsAndFixBugs(x)) - table, err := x.TableInfo(new(ReviewState)) - require.NoError(t, err) + tables := base.LoadTableSchemasMap(t, x) + table := tables["review_state"] column := table.GetColumn("updated_files") - require.NotNil(t, column) assert.Equal(t, "LONGTEXT", column.SQLType.Name) - table, err = x.TableInfo(new(PackageProperty)) - require.NoError(t, err) + table = tables["package_property"] column = table.GetColumn("value") - require.NotNil(t, column) assert.Equal(t, "LONGTEXT", column.SQLType.Name) - table, err = x.TableInfo(new(Notice)) - require.NoError(t, err) + table = tables["notice"] column = table.GetColumn("description") - require.NotNil(t, column) assert.Equal(t, "LONGTEXT", column.SQLType.Name) } diff --git a/models/migrations/v1_25/v322_test.go b/models/migrations/v1_25/v322_test.go index 690869a3c13ce..54f4cef7a5a63 100644 --- a/models/migrations/v1_25/v322_test.go +++ b/models/migrations/v1_25/v322_test.go @@ -10,7 +10,6 @@ import ( "code.gitea.io/gitea/modules/setting" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func Test_ExtendCommentTreePathLength(t *testing.T) { @@ -26,14 +25,8 @@ func Test_ExtendCommentTreePathLength(t *testing.T) { x, deferrable := base.PrepareTestEnv(t, 0, new(Comment)) defer deferrable() - require.NoError(t, ExtendCommentTreePathLength(x)) - - table, err := x.TableInfo(new(Comment)) - require.NoError(t, err) - + table := base.LoadTableSchemasMap(t, x)["comment"] column := table.GetColumn("tree_path") - require.NotNil(t, column) - assert.Contains(t, []string{"NVARCHAR", "VARCHAR"}, column.SQLType.Name) assert.EqualValues(t, int64(4000), column.Length) } From 0589dfd0854ac063f1aec73eae8dc30a81bad5a9 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 30 Oct 2025 19:18:27 +0800 Subject: [PATCH 13/14] fix test --- models/migrations/v1_25/v322_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/migrations/v1_25/v322_test.go b/models/migrations/v1_25/v322_test.go index 54f4cef7a5a63..d6ac886298b8a 100644 --- a/models/migrations/v1_25/v322_test.go +++ b/models/migrations/v1_25/v322_test.go @@ -28,5 +28,5 @@ func Test_ExtendCommentTreePathLength(t *testing.T) { table := base.LoadTableSchemasMap(t, x)["comment"] column := table.GetColumn("tree_path") assert.Contains(t, []string{"NVARCHAR", "VARCHAR"}, column.SQLType.Name) - assert.EqualValues(t, int64(4000), column.Length) + assert.EqualValues(t, 4000, column.Length) } From d468b0fd50f61ab6f3b06f16bcb0c39828a06cdd Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 30 Oct 2025 19:25:43 +0800 Subject: [PATCH 14/14] forgot to call the target function --- models/migrations/v1_25/v321_test.go | 3 ++- models/migrations/v1_25/v322_test.go | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/models/migrations/v1_25/v321_test.go b/models/migrations/v1_25/v321_test.go index 23dd7e54a1379..3ef2c68aa332b 100644 --- a/models/migrations/v1_25/v321_test.go +++ b/models/migrations/v1_25/v321_test.go @@ -11,6 +11,7 @@ import ( "code.gitea.io/gitea/modules/timeutil" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func Test_UseLongTextInSomeColumnsAndFixBugs(t *testing.T) { @@ -46,7 +47,7 @@ func Test_UseLongTextInSomeColumnsAndFixBugs(t *testing.T) { x, deferrable := base.PrepareTestEnv(t, 0, new(ReviewState), new(PackageProperty), new(Notice)) defer deferrable() - assert.NoError(t, UseLongTextInSomeColumnsAndFixBugs(x)) + require.NoError(t, UseLongTextInSomeColumnsAndFixBugs(x)) tables := base.LoadTableSchemasMap(t, x) table := tables["review_state"] diff --git a/models/migrations/v1_25/v322_test.go b/models/migrations/v1_25/v322_test.go index d6ac886298b8a..78d890704c530 100644 --- a/models/migrations/v1_25/v322_test.go +++ b/models/migrations/v1_25/v322_test.go @@ -10,6 +10,7 @@ import ( "code.gitea.io/gitea/modules/setting" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func Test_ExtendCommentTreePathLength(t *testing.T) { @@ -25,6 +26,7 @@ func Test_ExtendCommentTreePathLength(t *testing.T) { x, deferrable := base.PrepareTestEnv(t, 0, new(Comment)) defer deferrable() + require.NoError(t, ExtendCommentTreePathLength(x)) table := base.LoadTableSchemasMap(t, x)["comment"] column := table.GetColumn("tree_path") assert.Contains(t, []string{"NVARCHAR", "VARCHAR"}, column.SQLType.Name)