Fix dump bug
This commit is contained in:
parent
a7a1dc5c42
commit
6ebe3edd7d
|
@ -403,7 +403,7 @@ func (engine *Engine) dumpTables(tables []*schemas.Table, w io.Writer, tp ...sch
|
||||||
colNames := engine.dialect.Quoter().Join(cols, ", ")
|
colNames := engine.dialect.Quoter().Join(cols, ", ")
|
||||||
destColNames := dstDialect.Quoter().Join(cols, ", ")
|
destColNames := dstDialect.Quoter().Join(cols, ", ")
|
||||||
|
|
||||||
rows, err := engine.DB().QueryContext(engine.defaultContext, "SELECT "+colNames+" FROM "+engine.Quote(tableName))
|
rows, err := engine.DB().QueryContext(engine.defaultContext, "SELECT "+colNames+" FROM "+engine.Quote(table.Name))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,6 +97,12 @@ func TestDump(t *testing.T) {
|
||||||
_, err := sess.ImportFile(fp)
|
_, err := sess.ImportFile(fp)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.NoError(t, sess.Commit())
|
assert.NoError(t, sess.Commit())
|
||||||
|
|
||||||
|
for _, tp := range []schemas.DBType{schemas.SQLITE, schemas.MYSQL, schemas.POSTGRES, schemas.MSSQL} {
|
||||||
|
t.Run(fmt.Sprintf("dump_%v", tp), func(t *testing.T) {
|
||||||
|
assert.NoError(t, testEngine.DumpAllToFile(fp, tp))
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSetSchema(t *testing.T) {
|
func TestSetSchema(t *testing.T) {
|
||||||
|
|
Loading…
Reference in New Issue