@@ -11,6 +11,7 @@ import (
1111 "code.gitea.io/gitea/modules/timeutil"
1212
1313 "github.com/stretchr/testify/assert"
14+ "github.com/stretchr/testify/require"
1415)
1516
1617func Test_UseLongTextInSomeColumnsAndFixBugs (t * testing.T ) {
@@ -38,33 +39,26 @@ func Test_UseLongTextInSomeColumnsAndFixBugs(t *testing.T) {
3839 type Notice struct {
3940 ID int64 `xorm:"pk autoincr"`
4041 Type int
41- Description string `xorm:"LONGTEXT "`
42+ Description string `xorm:"TEXT "`
4243 CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
4344 }
4445
4546 // Prepare and load the testing database
46- x , deferable := base .PrepareTestEnv (t , 0 , new (ReviewState ), new (PackageProperty ), new (Notice ))
47- defer deferable ()
47+ x , deferrable := base .PrepareTestEnv (t , 0 , new (ReviewState ), new (PackageProperty ), new (Notice ))
48+ defer deferrable ()
4849
49- assert .NoError (t , UseLongTextInSomeColumnsAndFixBugs (x ))
50+ require .NoError (t , UseLongTextInSomeColumnsAndFixBugs (x ))
5051
51- tables , err := x .DBMetas ()
52- assert .NoError (t , err )
52+ tables := base .LoadTableSchemasMap (t , x )
53+ table := tables ["review_state" ]
54+ column := table .GetColumn ("updated_files" )
55+ assert .Equal (t , "LONGTEXT" , column .SQLType .Name )
5356
54- for _ , table := range tables {
55- switch table .Name {
56- case "review_state" :
57- column := table .GetColumn ("updated_files" )
58- assert .NotNil (t , column )
59- assert .Equal (t , "LONGTEXT" , column .SQLType .Name )
60- case "package_property" :
61- column := table .GetColumn ("value" )
62- assert .NotNil (t , column )
63- assert .Equal (t , "LONGTEXT" , column .SQLType .Name )
64- case "notice" :
65- column := table .GetColumn ("description" )
66- assert .NotNil (t , column )
67- assert .Equal (t , "LONGTEXT" , column .SQLType .Name )
68- }
69- }
57+ table = tables ["package_property" ]
58+ column = table .GetColumn ("value" )
59+ assert .Equal (t , "LONGTEXT" , column .SQLType .Name )
60+
61+ table = tables ["notice" ]
62+ column = table .GetColumn ("description" )
63+ assert .Equal (t , "LONGTEXT" , column .SQLType .Name )
7064}
0 commit comments