1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-26 20:28:40 +00:00

fix dump table name error and add some test for dump database (#6394) (#6402)

This commit is contained in:
Lunny Xiao
2019-03-21 17:11:44 +08:00
committed by zeripath
parent b6fb082b78
commit c5ec66a8a3
3 changed files with 21 additions and 3 deletions

View File

@@ -51,8 +51,9 @@ type Engine interface {
}
var (
x *xorm.Engine
tables []interface{}
x *xorm.Engine
supportedDatabases = []string{"mysql", "postgres", "mssql"}
tables []interface{}
// HasEngine specifies if we have a xorm.Engine
HasEngine bool
@@ -350,7 +351,9 @@ func Ping() error {
func DumpDatabase(filePath string, dbType string) error {
var tbs []*core.Table
for _, t := range tables {
tbs = append(tbs, x.TableInfo(t).Table)
t := x.TableInfo(t)
t.Table.Name = t.Name
tbs = append(tbs, t.Table)
}
if len(dbType) > 0 {
return x.DumpTablesToFile(tbs, filePath, core.DbType(dbType))