Skip to content

Commit

Permalink
fix(gen): fix gen model
Browse files Browse the repository at this point in the history
  • Loading branch information
jaronnie committed Jan 7, 2025
1 parent a3520cc commit 9a1f53f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions internal/gen/genmodel/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ func (jm *JzeroModel) Gen() error {
)

if jm.ModelMysqlDatasource {
allTables, err = getMysqlAllTables(jm.ModelMysqlDatasourceUrl)
tables, err := getMysqlAllTables(jm.ModelMysqlDatasourceUrl)
if err != nil {
return err
}

writeTables, err := jm.GenDDL(allTables)
writeTables, err := jm.GenDDL(tables)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/gen/genmodel/plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (jm *JzeroModel) GenDDL(tables []string) ([]string, error) {
for _, v := range tables {
if s, ok := tableDDLMap.Load(v); ok {
if len(jm.ModelMysqlDatasourceTable) != 0 && jm.ModelMysqlDatasourceTable[0] != "*" {
if lo.Contains(jm.ModelMysqlDatasourceTable, cast.ToString(s)) {
if lo.Contains(jm.ModelMysqlDatasourceTable, cast.ToString(v)) {
writeTables = append(writeTables, "desc", "sql", fmt.Sprintf("%s.sql", v))
if err := os.WriteFile(filepath.Join("desc", "sql", fmt.Sprintf("%s.sql", v)), []byte(cast.ToString(s)), 0o644); err != nil {
return nil, err
Expand Down

0 comments on commit 9a1f53f

Please sign in to comment.