File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ // Copyright 2025 The Gitea Authors. All rights reserved.
2+ // SPDX-License-Identifier: MIT
3+
4+ package v1_25
5+
6+ import (
7+ "testing"
8+
9+ "code.gitea.io/gitea/models/migrations/base"
10+ "code.gitea.io/gitea/modules/setting"
11+ "github.com/stretchr/testify/assert"
12+ )
13+
14+ func Test_ExtendCommentTreePathLength (t * testing.T ) {
15+ if setting .Database .Type .IsSQLite3 () {
16+ t .Skip ("For SQLITE, varchar or char will always be represented as TEXT" )
17+ }
18+
19+ type Comment struct {
20+ ID int64 `xorm:"pk autoincr"`
21+ TreePath string `xorm:"VARCHAR(500)"`
22+ }
23+
24+ x , deferable := base .PrepareTestEnv (t , 0 , new (Comment ))
25+ defer deferable ()
26+
27+ assert .NoError (t , ExtendCommentTreePathLength (x ))
28+
29+ tables , err := x .DBMetas ()
30+ assert .NoError (t , err )
31+
32+ for _ , table := range tables {
33+ switch table .Name {
34+ case "comment" :
35+ column := table .GetColumn ("tree_path" )
36+ assert .NotNil (t , column )
37+ assert .Equal (t , "VARCHAR" , column .SQLType .Name )
38+ assert .Equal (t , 4000 , column .Length )
39+ }
40+ }
41+ }
You can’t perform that action at this time.
0 commit comments