* fix issue #831

* fix typo

Co-authored-by: anqiansong <anqiansong@xiaoheiban.cn>
This commit is contained in:
anqiansong
2021-07-28 16:32:15 +08:00
committed by GitHub
parent cb7b7cb72e
commit 9f4a882a1b
9 changed files with 152 additions and 6 deletions

View File

@@ -13,6 +13,7 @@ import (
"github.com/tal-tech/go-zero/tools/goctl/model/sql/gen"
"github.com/tal-tech/go-zero/tools/goctl/model/sql/model"
"github.com/tal-tech/go-zero/tools/goctl/model/sql/util"
file "github.com/tal-tech/go-zero/tools/goctl/util"
"github.com/tal-tech/go-zero/tools/goctl/util/console"
"github.com/urfave/cli"
)
@@ -39,6 +40,11 @@ func MysqlDDL(ctx *cli.Context) error {
idea := ctx.Bool(flagIdea)
style := ctx.String(flagStyle)
database := ctx.String(flagDatabase)
home := ctx.String("home")
if len(home) > 0 {
file.RegisterGoctlHome(home)
}
cfg, err := config.NewConfig(style)
if err != nil {
return err
@@ -54,6 +60,12 @@ func MySqlDataSource(ctx *cli.Context) error {
cache := ctx.Bool(flagCache)
idea := ctx.Bool(flagIdea)
style := ctx.String(flagStyle)
home := ctx.String("home")
if len(home) > 0 {
file.RegisterGoctlHome(home)
}
pattern := strings.TrimSpace(ctx.String(flagTable))
cfg, err := config.NewConfig(style)
if err != nil {
@@ -71,6 +83,12 @@ func PostgreSqlDataSource(ctx *cli.Context) error {
idea := ctx.Bool(flagIdea)
style := ctx.String(flagStyle)
schema := ctx.String(flagSchema)
home := ctx.String("home")
if len(home) > 0 {
file.RegisterGoctlHome(home)
}
if len(schema) == 0 {
schema = "public"
}