From cb10f2767c920fdbca6fc43e71dcc4c4b8c6e0d0 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sat, 30 Dec 2023 21:54:48 +0800 Subject: [PATCH] Fix migration test (#28659) --- models/migrations/v1_22/v283_test.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/models/migrations/v1_22/v283_test.go b/models/migrations/v1_22/v283_test.go index 864f47f840c..e89a7cbfc2c 100644 --- a/models/migrations/v1_22/v283_test.go +++ b/models/migrations/v1_22/v283_test.go @@ -7,22 +7,22 @@ import ( "testing" "code.gitea.io/gitea/models/migrations/base" + + "github.com/stretchr/testify/assert" ) func Test_AddCombinedIndexToIssueUser(t *testing.T) { - type IssueUser struct { - UID int64 `xorm:"INDEX unique(uid_to_issue)"` // User ID. - IssueID int64 `xorm:"INDEX unique(uid_to_issue)"` + type IssueUser struct { // old struct + ID int64 `xorm:"pk autoincr"` + UID int64 `xorm:"INDEX"` // User ID. + IssueID int64 `xorm:"INDEX"` + IsRead bool + IsMentioned bool } // Prepare and load the testing database x, deferable := base.PrepareTestEnv(t, 0, new(IssueUser)) defer deferable() - if x == nil || t.Failed() { - return - } - if err := AddCombinedIndexToIssueUser(x); err != nil { - t.Fatal(err) - } + assert.NoError(t, AddCombinedIndexToIssueUser(x)) }