2023-12-14 09:26:59 +00:00
|
|
|
// Copyright 2023 The Gitea Authors. All rights reserved.
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
|
|
|
package v1_22 //nolint
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2024-07-14 13:34:42 +00:00
|
|
|
migration_tests "code.gitea.io/gitea/models/migrations/test"
|
2023-12-30 13:54:48 +00:00
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
2023-12-14 09:26:59 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func Test_AddCombinedIndexToIssueUser(t *testing.T) {
|
2023-12-30 13:54:48 +00:00
|
|
|
type IssueUser struct { // old struct
|
|
|
|
ID int64 `xorm:"pk autoincr"`
|
|
|
|
UID int64 `xorm:"INDEX"` // User ID.
|
|
|
|
IssueID int64 `xorm:"INDEX"`
|
|
|
|
IsRead bool
|
|
|
|
IsMentioned bool
|
2023-12-14 09:26:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Prepare and load the testing database
|
2024-07-14 13:34:42 +00:00
|
|
|
x, deferable := migration_tests.PrepareTestEnv(t, 0, new(IssueUser))
|
2023-12-14 09:26:59 +00:00
|
|
|
defer deferable()
|
|
|
|
|
2023-12-30 13:54:48 +00:00
|
|
|
assert.NoError(t, AddCombinedIndexToIssueUser(x))
|
2023-12-14 09:26:59 +00:00
|
|
|
}
|