diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2019-03-21 09:38:54 +0800 |
---|---|---|
committer | techknowlogick <matti@mdranta.net> | 2019-03-20 21:38:54 -0400 |
commit | 91dcccf72d15d9d6dbe9c0cc5c5d33c082225cde (patch) | |
tree | 2b97fb34e12dad497c4cf7b994e540d247907096 /models/models.go | |
parent | 75601a8cbc7b1c2bd9cbc21bca49f89ff3db8445 (diff) | |
download | gitea-91dcccf72d15d9d6dbe9c0cc5c5d33c082225cde.tar.gz gitea-91dcccf72d15d9d6dbe9c0cc5c5d33c082225cde.zip |
fix dump table name error and add some test for dump database (#6394)
Diffstat (limited to 'models/models.go')
-rw-r--r-- | models/models.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/models/models.go b/models/models.go index ac7e2e93ba..e7ecc67fc5 100644 --- a/models/models.go +++ b/models/models.go @@ -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)) |