You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by GitBox <gi...@apache.org> on 2022/07/20 08:27:43 UTC

[GitHub] [incubator-devlake] abeizn opened a new pull request, #2553: fix: generator adapt new migration

abeizn opened a new pull request, #2553:
URL: https://github.com/apache/incubator-devlake/pull/2553

   # Summary
   
   generator adapt new migration
   
   ### Does this close any open issues?
   fix: #2540 
   
   ### Screenshots
   Include any relevant screenshots here.
   
   ### Other Information
   Any other information that is important to this PR.
   


-- 
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: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] likyh commented on a diff in pull request #2553: fix: generator adapt new migration

Posted by GitBox <gi...@apache.org>.
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: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] abeizn commented on a diff in pull request #2553: fix: generator adapt new migration

Posted by GitBox <gi...@apache.org>.
abeizn commented on code in PR #2553:
URL: https://github.com/apache/incubator-devlake/pull/2553#discussion_r925366716


##########
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:
   updated



-- 
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: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] abeizn commented on a diff in pull request #2553: fix: generator adapt new migration

Posted by GitBox <gi...@apache.org>.
abeizn commented on code in PR #2553:
URL: https://github.com/apache/incubator-devlake/pull/2553#discussion_r925369419


##########
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:
   yes



-- 
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: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] abeizn merged pull request #2553: fix: generator adapt new migration

Posted by GitBox <gi...@apache.org>.
abeizn merged PR #2553:
URL: https://github.com/apache/incubator-devlake/pull/2553


-- 
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: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] abeizn commented on a diff in pull request #2553: fix: generator adapt new migration

Posted by GitBox <gi...@apache.org>.
abeizn commented on code in PR #2553:
URL: https://github.com/apache/incubator-devlake/pull/2553#discussion_r925385659


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

Review Comment:
   No, Not add a date this time



-- 
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: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] abeizn commented on a diff in pull request #2553: fix: generator adapt new migration

Posted by GitBox <gi...@apache.org>.
abeizn commented on code in PR #2553:
URL: https://github.com/apache/incubator-devlake/pull/2553#discussion_r925386025


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

Review Comment:
   > 
   updated



-- 
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: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org