Add test for dump table with default value

This commit is contained in:
Lunny Xiao 2021-06-12 17:38:57 +08:00
parent 7fd6356a85
commit ab0552c7ad
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
1 changed files with 17 additions and 0 deletions

View File

@ -176,6 +176,23 @@ func TestDumpTables(t *testing.T) {
}
}
func TestDumpTables2(t *testing.T) {
assert.NoError(t, PrepareEngine())
type TestDumpTableStruct2 struct {
Id int64
Created time.Time `xorm:"Default CURRENT_TIMESTAMP"`
}
assertSync(t, new(TestDumpTableStruct2))
fp := fmt.Sprintf("./dump2-%v-table.sql", testEngine.Dialect().URI().DBType)
os.Remove(fp)
tb, err := testEngine.TableInfo(new(TestDumpTableStruct2))
assert.NoError(t, err)
assert.NoError(t, testEngine.(*xorm.Engine).DumpTablesToFile([]*schemas.Table{tb}, fp))
}
func TestSetSchema(t *testing.T) {
assert.NoError(t, PrepareEngine())