summaryrefslogtreecommitdiffstats
path: root/models/migrations/v1_22/v283_test.go
blob: 5f6c04a881b4a4a5bc50289b617c071c5b328fb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright 2023 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT

package v1_22 //nolint

import (
	"testing"

	migration_tests "code.gitea.io/gitea/models/migrations/test"

	"github.com/stretchr/testify/require"
)

func Test_AddCombinedIndexToIssueUser(t *testing.T) {
	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 := migration_tests.PrepareTestEnv(t, 0, new(IssueUser))
	defer deferable()

	require.NoError(t, AddCombinedIndexToIssueUser(x))
}