mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 08:02:15 +03:00
https://github.com/hasura/graphql-engine/pull/5710
This commit is contained in:
parent
09d0d58436
commit
c348ea7a9d
@ -12,6 +12,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
"text/tabwriter"
|
||||
"time"
|
||||
@ -1849,9 +1850,22 @@ func (m *Migrate) ApplySeed(q interface{}) error {
|
||||
func (m *Migrate) ExportDataDump(tableNames []string) ([]byte, error) {
|
||||
// to support tables starting with capital letters
|
||||
modifiedTableNames := make([]string, len(tableNames))
|
||||
|
||||
for idx, val := range tableNames {
|
||||
modifiedTableNames[idx] = fmt.Sprintf(`"%s"`, val)
|
||||
split := strings.Split(val, ".")
|
||||
splitLen := len(split)
|
||||
|
||||
if splitLen != 1 && splitLen != 2 {
|
||||
return nil, fmt.Errorf(`invalid schema/table provided "%s"`, val)
|
||||
}
|
||||
|
||||
if splitLen == 2 {
|
||||
modifiedTableNames[idx] = fmt.Sprintf(`"%s"."%s"`, split[0], split[1])
|
||||
} else {
|
||||
modifiedTableNames[idx] = fmt.Sprintf(`"%s"`, val)
|
||||
}
|
||||
}
|
||||
|
||||
return m.databaseDrv.ExportDataDump(modifiedTableNames)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user