Add test for dump table with default value (#1950)
Confirm #1391 resolved. Reviewed-on: https://gitea.com/xorm/xorm/pulls/1950 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
parent
7fd6356a85
commit
00ee06fdd5
|
@ -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) {
|
func TestSetSchema(t *testing.T) {
|
||||||
assert.NoError(t, PrepareEngine())
|
assert.NoError(t, PrepareEngine())
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue