From 584f744a28f250e08dcb229ade037211073e4524 Mon Sep 17 00:00:00 2001 From: lijunshi Date: Sun, 28 Apr 2024 13:53:43 +0800 Subject: [PATCH] fix:fix ci error 4 --- tests/schema_test.go | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/tests/schema_test.go b/tests/schema_test.go index bf325542..2d5007e1 100644 --- a/tests/schema_test.go +++ b/tests/schema_test.go @@ -753,27 +753,30 @@ func getKeysFromMap(m map[string]*schemas.Index) []string { } func TestSync2_3(t *testing.T) { - type SyncTestUser struct { - Id int `xorm:"pk autoincr 'id'"` - Name string `xorm:"'name' notnull comment('nickname')" json:"name"` - } - assert.NoError(t, PrepareEngine()) - assert.NoError(t, testEngine.Sync2(new(SyncTestUser))) + if testEngine.Dialect().URI().DBType == schemas.MYSQL { + type SyncTestUser struct { + Id int `xorm:"pk autoincr 'id'"` + Name string `xorm:"'name' notnull comment('nickname')" json:"name"` + } + assert.NoError(t, PrepareEngine()) + assert.NoError(t, testEngine.Sync2(new(SyncTestUser))) - // add comment for id column - type SyncTestUser2 struct { - Id int `xorm:"pk autoincr 'id' comment('primary key')"` - Name string `xorm:"'name' notnull comment('nickname')" json:"name"` - } - assert.NoError(t, testEngine.Table("sync_test_user").Sync2(new(SyncTestUser2))) - tables, err := testEngine.DBMetas() - assert.NoError(t, err) - tableInfo, err := testEngine.TableInfo(new(SyncTestUser2)) + // add comment for id column + type SyncTestUser2 struct { + Id int `xorm:"pk autoincr 'id' comment('primary key')"` + Name string `xorm:"'name' notnull comment('nickname')" json:"name"` + } + assert.NoError(t, testEngine.Table("sync_test_user").Sync2(new(SyncTestUser2))) + tables, err := testEngine.DBMetas() + assert.NoError(t, err) + tableInfo, err := testEngine.TableInfo(new(SyncTestUser2)) - assert.EqualValues(t, tables[0].GetColumn("id").IsAutoIncrement, tableInfo.GetColumn("id").IsAutoIncrement) - assert.EqualValues(t, tables[0].GetColumn("id").Name, tableInfo.GetColumn("id").Name) - assert.EqualValues(t, tables[0].GetColumn("id").SQLType.Name, tableInfo.GetColumn("id").SQLType.Name) - assert.EqualValues(t, tables[0].GetColumn("id").Nullable, tableInfo.GetColumn("id").Nullable) - assert.EqualValues(t, tables[0].GetColumn("id").Comment, tableInfo.GetColumn("id").Comment) + assert.EqualValues(t, tables[0].GetColumn("id").IsAutoIncrement, tableInfo.GetColumn("id").IsAutoIncrement) + assert.EqualValues(t, tables[0].GetColumn("id").Name, tableInfo.GetColumn("id").Name) + assert.EqualValues(t, tables[0].GetColumn("id").SQLType.Name, tableInfo.GetColumn("id").SQLType.Name) + assert.EqualValues(t, tables[0].GetColumn("id").Nullable, tableInfo.GetColumn("id").Nullable) + assert.EqualValues(t, tables[0].GetColumn("id").Comment, tableInfo.GetColumn("id").Comment) + + } } \ No newline at end of file