test comments on columns with MySQL/MariaDB too

remove PostgreSQL specific parts
This commit is contained in:
Pierre-Louis Bonicoli 2022-04-13 03:36:41 +02:00
parent b3f9c53d8a
commit 701ebcb111
No known key found for this signature in database
GPG Key ID: 06914C4A5EDAA6DD
1 changed files with 6 additions and 8 deletions

View File

@ -255,23 +255,21 @@ func TestDBVersion(t *testing.T) {
fmt.Println(testEngine.Dialect().URI().DBType, "version is", version) fmt.Println(testEngine.Dialect().URI().DBType, "version is", version)
} }
func TestGetColumns(t *testing.T) { func TestGetColumnsComment(t *testing.T) {
if testEngine.Dialect().URI().DBType != schemas.POSTGRES { switch testEngine.Dialect().URI().DBType {
case schemas.POSTGRES, schemas.MYSQL:
default:
t.Skip() t.Skip()
return return
} }
comment := "this is a comment"
type TestCommentStruct struct { type TestCommentStruct struct {
HasComment int HasComment int `xorm:"comment('this is a comment')"`
NoComment int NoComment int
} }
assertSync(t, new(TestCommentStruct)) assertSync(t, new(TestCommentStruct))
comment := "this is a comment"
sql := fmt.Sprintf("comment on column %s.%s is '%s'", testEngine.TableName(new(TestCommentStruct), true), "has_comment", comment)
_, err := testEngine.Exec(sql)
assert.NoError(t, err)
tables, err := testEngine.DBMetas() tables, err := testEngine.DBMetas()
assert.NoError(t, err) assert.NoError(t, err)
tableName := testEngine.GetColumnMapper().Obj2Table("TestCommentStruct") tableName := testEngine.GetColumnMapper().Obj2Table("TestCommentStruct")