Skip to content

Commit

Permalink
Fix migration test (go-gitea#28659)
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny authored and silverwind committed Feb 20, 2024
1 parent 58ccac7 commit e6819fe
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions models/migrations/v1_22/v283_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

0 comments on commit e6819fe

Please sign in to comment.