Skip to content

Commit cb10f27

Browse files
authored
Fix migration test (#28659)
1 parent e5d8c4b commit cb10f27

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

models/migrations/v1_22/v283_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@ import (
77
"testing"
88

99
"code.gitea.io/gitea/models/migrations/base"
10+
11+
"github.com/stretchr/testify/assert"
1012
)
1113

1214
func Test_AddCombinedIndexToIssueUser(t *testing.T) {
13-
type IssueUser struct {
14-
UID int64 `xorm:"INDEX unique(uid_to_issue)"` // User ID.
15-
IssueID int64 `xorm:"INDEX unique(uid_to_issue)"`
15+
type IssueUser struct { // old struct
16+
ID int64 `xorm:"pk autoincr"`
17+
UID int64 `xorm:"INDEX"` // User ID.
18+
IssueID int64 `xorm:"INDEX"`
19+
IsRead bool
20+
IsMentioned bool
1621
}
1722

1823
// Prepare and load the testing database
1924
x, deferable := base.PrepareTestEnv(t, 0, new(IssueUser))
2025
defer deferable()
21-
if x == nil || t.Failed() {
22-
return
23-
}
2426

25-
if err := AddCombinedIndexToIssueUser(x); err != nil {
26-
t.Fatal(err)
27-
}
27+
assert.NoError(t, AddCombinedIndexToIssueUser(x))
2828
}

0 commit comments

Comments
 (0)