gitea源码

v283_test.go 647B

1234567891011121314151617181920212223242526272829
  1. // Copyright 2023 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package v1_22
  4. import (
  5. "testing"
  6. "code.gitea.io/gitea/models/migrations/base"
  7. "github.com/stretchr/testify/assert"
  8. )
  9. func Test_AddCombinedIndexToIssueUser(t *testing.T) {
  10. type IssueUser struct { // old struct
  11. ID int64 `xorm:"pk autoincr"`
  12. UID int64 `xorm:"INDEX"` // User ID.
  13. IssueID int64 `xorm:"INDEX"`
  14. IsRead bool
  15. IsMentioned bool
  16. }
  17. // Prepare and load the testing database
  18. x, deferable := base.PrepareTestEnv(t, 0, new(IssueUser))
  19. defer deferable()
  20. assert.NoError(t, AddCombinedIndexToIssueUser(x))
  21. }