mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-10 04:05:42 +01:00
Fix migration test (#28659)
This commit is contained in:
parent
e5d8c4b8d4
commit
cb10f2767c
1 changed files with 9 additions and 9 deletions
|
@ -7,22 +7,22 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"code.gitea.io/gitea/models/migrations/base"
|
"code.gitea.io/gitea/models/migrations/base"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_AddCombinedIndexToIssueUser(t *testing.T) {
|
func Test_AddCombinedIndexToIssueUser(t *testing.T) {
|
||||||
type IssueUser struct {
|
type IssueUser struct { // old struct
|
||||||
UID int64 `xorm:"INDEX unique(uid_to_issue)"` // User ID.
|
ID int64 `xorm:"pk autoincr"`
|
||||||
IssueID int64 `xorm:"INDEX unique(uid_to_issue)"`
|
UID int64 `xorm:"INDEX"` // User ID.
|
||||||
|
IssueID int64 `xorm:"INDEX"`
|
||||||
|
IsRead bool
|
||||||
|
IsMentioned bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare and load the testing database
|
// Prepare and load the testing database
|
||||||
x, deferable := base.PrepareTestEnv(t, 0, new(IssueUser))
|
x, deferable := base.PrepareTestEnv(t, 0, new(IssueUser))
|
||||||
defer deferable()
|
defer deferable()
|
||||||
if x == nil || t.Failed() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := AddCombinedIndexToIssueUser(x); err != nil {
|
assert.NoError(t, AddCombinedIndexToIssueUser(x))
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue