Selaa lähdekoodia

fix dump to other databases

xormplus 9 vuotta sitten
vanhempi
commit
5bb49a1a6a
1 muutettua tiedostoa jossa 4 lisäystä ja 1 poistoa
  1. 4 1
      engine.go

+ 4 - 1
engine.go

@@ -544,18 +544,21 @@ func (engine *Engine) dumpAll(w io.Writer, tp ...core.DbType) error {
 // DumpAll dump database all table structs and data to w with specify db type
 func (engine *Engine) dumpTables(tables []*core.Table, w io.Writer, tp ...core.DbType) error {
 	var dialect core.Dialect
+	var distDBName string
 	if len(tp) == 0 {
 		dialect = engine.dialect
+		distDBName = string(engine.dialect.DBType())
 	} else {
 		dialect = core.QueryDialect(tp[0])
 		if dialect == nil {
 			return errors.New("Unsupported database type")
 		}
 		dialect.Init(nil, engine.dialect.URI(), "", "")
+		distDBName = string(tp[0])
 	}
 
 	_, err := io.WriteString(w, fmt.Sprintf("/*Generated by xorm v%s %s, from %s to %s*/\n\n",
-		Version, time.Now().In(engine.TZLocation).Format("2006-01-02 15:04:05"), engine.dialect.DBType(), dialect.DBType()))
+		Version, time.Now().In(engine.TZLocation).Format("2006-01-02 15:04:05"), engine.dialect.DBType(), strings.ToUpper(distDBName)))
 	if err != nil {
 		return err
 	}