fix:fix ci error 3
This commit is contained in:
parent
16f6b54c95
commit
059a5d3333
|
@ -753,33 +753,28 @@ func getKeysFromMap(m map[string]*schemas.Index) []string {
|
|||
}
|
||||
|
||||
func TestSync2_3(t *testing.T) {
|
||||
func() {
|
||||
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)))
|
||||
}()
|
||||
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)))
|
||||
|
||||
func() {
|
||||
// add comment for id column
|
||||
type SyncTestUser struct {
|
||||
Id int `xorm:"pk autoincr 'id' comment('primary key')"`
|
||||
Name string `xorm:"'name' notnull comment('nickname')" json:"name"`
|
||||
}
|
||||
assert.NoError(t, PrepareEngine())
|
||||
assert.NoError(t, testEngine.Sync2(new(SyncTestUser)))
|
||||
tables, err := testEngine.DBMetas()
|
||||
assert.NoError(t, err)
|
||||
tableInfo, err := testEngine.TableInfo(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))
|
||||
|
||||
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, tableInfo.GetColumn("id").SQLType)
|
||||
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").IsPrimaryKey, tableInfo.GetColumn("id").IsPrimaryKey)
|
||||
}()
|
||||
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").IsPrimaryKey, tableInfo.GetColumn("id").IsPrimaryKey)
|
||||
|
||||
}
|
Loading…
Reference in New Issue