likyh commented on code in PR #2553:
URL: https://github.com/apache/incubator-devlake/pull/2553#discussion_r925358803


##########
generator/template/migrationscripts/migration.go-template:
##########
@@ -22,17 +22,17 @@ import (
        "gorm.io/gorm"
 )
 
-type updateSchemas{{ .Date }}{{ .Count }} struct{}
+type {{ .Purpose }} struct{}

Review Comment:
   Purpose should convert camel format `pruposeName` here



##########
generator/cmd/create_migration.go:
##########
@@ -103,9 +103,9 @@ If framework passed, generator will create a new migration 
in models/migrationsc
                // read template
                templates := map[string]string{}
                if withConfig == `Yes` {
-                       
templates[`updateSchemas`+values[`Date`]+values[`Count`]+`.go`] = 
util.ReadTemplate("generator/template/migrationscripts/migration_with_config.go-template")
+                       templates[values[`Date`]+`_`+values[`Purpose`]+`.go`] = 
util.ReadTemplate("generator/template/migrationscripts/migration_with_config.go-template")

Review Comment:
   Purpose should filter space. and should convert to snake format 
`aaa_bbb_ccc`.



##########
generator/util/template.go:
##########
@@ -47,10 +47,10 @@ func ReadTemplate(templateFile string) string {
 
 // WriteTemplates write some strings to files
 func WriteTemplates(path string, templates map[string]string) {
-       err := os.MkdirAll(path, 0600)
+       err := os.MkdirAll(path, 0755)

Review Comment:
   Is it can pass linter?



##########
generator/template/migrationscripts/migration.go-template:
##########
@@ -22,17 +22,17 @@ import (
        "gorm.io/gorm"
 )
 
-type updateSchemas{{ .Date }}{{ .Count }} struct{}
+type {{ .Purpose }} struct{}

Review Comment:
   add a date after pruposeName to avoid duplicating ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to