This commit is contained in:
Lunny Xiao 2020-03-21 23:46:46 +08:00
parent 6ebe3edd7d
commit 07cb5ec7dc
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
1 changed files with 5 additions and 1 deletions

View File

@ -375,6 +375,10 @@ func (engine *Engine) dumpTables(tables []*schemas.Table, w io.Writer, tp ...sch
if dstDialect.URI().Schema != "" { if dstDialect.URI().Schema != "" {
tableName = fmt.Sprintf("%s.%s", dstDialect.URI().Schema, table.Name) tableName = fmt.Sprintf("%s.%s", dstDialect.URI().Schema, table.Name)
} }
originalTableName := table.Name
if engine.dialect.URI().Schema != "" {
originalTableName = fmt.Sprintf("%s.%s", engine.dialect.URI().Schema, table.Name)
}
if i > 0 { if i > 0 {
_, err = io.WriteString(w, "\n") _, err = io.WriteString(w, "\n")
if err != nil { if err != nil {
@ -403,7 +407,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(table.Name)) rows, err := engine.DB().QueryContext(engine.defaultContext, "SELECT "+colNames+" FROM "+engine.Quote(originalTableName))
if err != nil { if err != nil {
return err return err
} }