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/12/14 05:03:30 UTC
[GitHub] [incubator-devlake] warren830 opened a new pull request, #3927: fix(github): add clone url to repo and concat name and owner
warren830 opened a new pull request, #3927:
URL: https://github.com/apache/incubator-devlake/pull/3927
### Summary
add cloneUrl to githubRepo for convenience of bp v200
concat owner and repo for _github_tool_repos
### Does this close any open issues?
Relate to #3803
### 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] klesh commented on a diff in pull request #3927: fix(github): add clone url to repo and concat name and owner
Posted by GitBox <gi...@apache.org>.
klesh commented on code in PR #3927:
URL: https://github.com/apache/incubator-devlake/pull/3927#discussion_r1048094614
##########
plugins/github/models/migrationscripts/20221214_concat_owner_name_for_repo.go:
##########
@@ -0,0 +1,61 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package migrationscripts
+
+import (
+ "fmt"
+ "github.com/apache/incubator-devlake/errors"
+ "github.com/apache/incubator-devlake/helpers/migrationhelper"
+ "github.com/apache/incubator-devlake/plugins/core"
+)
+
+type githubRepoToBeTransform struct {
+ ConnectionId uint64 `gorm:"primaryKey"`
+ GithubId int `gorm:"primaryKey"`
+ Name string `gorm:"type:varchar(255)"`
+ OwnerLogin string `json:"ownerLogin" gorm:"type:varchar(255)"`
+}
+
+type concatOwnerAndName struct{}
+
+func (script *concatOwnerAndName) Up(basicRes core.BasicRes) errors.Error {
+ return migrationhelper.TransformColumns(
+ basicRes,
+ script,
+ "_tool_github_repos",
+ []string{"name", "owner_login"},
+ func(src *githubRepoToBeTransform) (*githubRepoToBeTransform, errors.Error) {
+ if src.OwnerLogin != "" {
+ src.Name = fmt.Sprintf("%s/%s", src.OwnerLogin, src.Name)
+ }
+ return &githubRepoToBeTransform{
+ GithubId: src.GithubId,
+ ConnectionId: src.ConnectionId,
+ Name: src.Name,
+ OwnerLogin: "",
Review Comment:
So, why do we keep this empty field?
--
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] warren830 commented on a diff in pull request #3927: fix(github): add clone url to repo and concat name and owner
Posted by GitBox <gi...@apache.org>.
warren830 commented on code in PR #3927:
URL: https://github.com/apache/incubator-devlake/pull/3927#discussion_r1048244127
##########
plugins/github/models/migrationscripts/20221214_concat_owner_name_for_repo.go:
##########
@@ -0,0 +1,61 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package migrationscripts
+
+import (
+ "fmt"
+ "github.com/apache/incubator-devlake/errors"
+ "github.com/apache/incubator-devlake/helpers/migrationhelper"
+ "github.com/apache/incubator-devlake/plugins/core"
+)
+
+type githubRepoToBeTransform struct {
+ ConnectionId uint64 `gorm:"primaryKey"`
+ GithubId int `gorm:"primaryKey"`
+ Name string `gorm:"type:varchar(255)"`
+ OwnerLogin string `json:"ownerLogin" gorm:"type:varchar(255)"`
+}
+
+type concatOwnerAndName struct{}
+
+func (script *concatOwnerAndName) Up(basicRes core.BasicRes) errors.Error {
+ return migrationhelper.TransformColumns(
+ basicRes,
+ script,
+ "_tool_github_repos",
+ []string{"name", "owner_login"},
+ func(src *githubRepoToBeTransform) (*githubRepoToBeTransform, errors.Error) {
+ if src.OwnerLogin != "" {
+ src.Name = fmt.Sprintf("%s/%s", src.OwnerLogin, src.Name)
+ }
+ return &githubRepoToBeTransform{
+ GithubId: src.GithubId,
+ ConnectionId: src.ConnectionId,
+ Name: src.Name,
+ OwnerLogin: "",
Review Comment:
fixed
--
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] klesh commented on a diff in pull request #3927: fix(github): add clone url to repo and concat name and owner
Posted by GitBox <gi...@apache.org>.
klesh commented on code in PR #3927:
URL: https://github.com/apache/incubator-devlake/pull/3927#discussion_r1048065585
##########
plugins/github/models/repo.go:
##########
@@ -34,9 +34,10 @@ type GithubRepo struct {
Language string `json:"language" gorm:"type:varchar(255)" mapstructure:"language,omitempty"`
ParentGithubId int `json:"parentId" mapstructure:"parentGithubId,omitempty"`
ParentHTMLUrl string `json:"parentHtmlUrl" mapstructure:"parentHtmlUrl,omitempty"`
+ CloneUrl string `json:"cloneUrl" gorm:"type:varchar(255)" mapstructure:"cloneUrl,omitempty"`
CreatedDate *time.Time `json:"createdDate" mapstructure:"-"`
UpdatedDate *time.Time `json:"updatedDate" mapstructure:"-"`
- common.NoPKModel `json:"-" mapstructure:"-"`
+ common.NoPKModel `json:"-" mapstructure:"-" swaggerignore:"true"`
Review Comment:
Will these make the `createdAt` `updatedAt` disappear from response body?
if so, we should move it to :

--
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] mappjzc merged pull request #3927: fix(github): add clone url to repo and concat name and owner
Posted by GitBox <gi...@apache.org>.
mappjzc merged PR #3927:
URL: https://github.com/apache/incubator-devlake/pull/3927
--
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] mappjzc commented on a diff in pull request #3927: fix(github): add clone url to repo and concat name and owner
Posted by GitBox <gi...@apache.org>.
mappjzc commented on code in PR #3927:
URL: https://github.com/apache/incubator-devlake/pull/3927#discussion_r1049596150
##########
plugins/github/models/migrationscripts/20221214_concat_owner_name_for_repo.go:
##########
@@ -0,0 +1,61 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package migrationscripts
+
+import (
+ "fmt"
+ "github.com/apache/incubator-devlake/errors"
+ "github.com/apache/incubator-devlake/helpers/migrationhelper"
+ "github.com/apache/incubator-devlake/plugins/core"
+)
+
+type githubRepoToBeTransform struct {
+ ConnectionId uint64 `gorm:"primaryKey"`
+ GithubId int `gorm:"primaryKey"`
+ Name string `gorm:"type:varchar(255)"`
+ OwnerLogin string `json:"ownerLogin" gorm:"type:varchar(255)"`
+}
+
+type concatOwnerAndName struct{}
+
+func (script *concatOwnerAndName) Up(basicRes core.BasicRes) errors.Error {
+ return migrationhelper.TransformColumns(
+ basicRes,
+ script,
+ "_tool_github_repos",
+ []string{"name", "owner_login"},
+ func(src *githubRepoToBeTransform) (*githubRepoToBeTransform, errors.Error) {
+ if src.OwnerLogin != "" {
+ src.Name = fmt.Sprintf("%s/%s", src.OwnerLogin, src.Name)
+ }
+ return &githubRepoToBeTransform{
+ GithubId: src.GithubId,
+ ConnectionId: src.ConnectionId,
+ Name: src.Name,
+ OwnerLogin: "",
Review Comment:
it seems you remove the column OwnerLogin but forget to remove it on TransformColumns.
--
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] warren830 commented on a diff in pull request #3927: fix(github): add clone url to repo and concat name and owner
Posted by GitBox <gi...@apache.org>.
warren830 commented on code in PR #3927:
URL: https://github.com/apache/incubator-devlake/pull/3927#discussion_r1048118304
##########
plugins/github/models/migrationscripts/20221214_concat_owner_name_for_repo.go:
##########
@@ -0,0 +1,61 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package migrationscripts
+
+import (
+ "fmt"
+ "github.com/apache/incubator-devlake/errors"
+ "github.com/apache/incubator-devlake/helpers/migrationhelper"
+ "github.com/apache/incubator-devlake/plugins/core"
+)
+
+type githubRepoToBeTransform struct {
+ ConnectionId uint64 `gorm:"primaryKey"`
+ GithubId int `gorm:"primaryKey"`
+ Name string `gorm:"type:varchar(255)"`
+ OwnerLogin string `json:"ownerLogin" gorm:"type:varchar(255)"`
+}
+
+type concatOwnerAndName struct{}
+
+func (script *concatOwnerAndName) Up(basicRes core.BasicRes) errors.Error {
+ return migrationhelper.TransformColumns(
+ basicRes,
+ script,
+ "_tool_github_repos",
+ []string{"name", "owner_login"},
+ func(src *githubRepoToBeTransform) (*githubRepoToBeTransform, errors.Error) {
+ if src.OwnerLogin != "" {
+ src.Name = fmt.Sprintf("%s/%s", src.OwnerLogin, src.Name)
+ }
+ return &githubRepoToBeTransform{
+ GithubId: src.GithubId,
+ ConnectionId: src.ConnectionId,
+ Name: src.Name,
+ OwnerLogin: "",
Review Comment:
fixed
--
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