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/11/11 11:48:41 UTC

[GitHub] [incubator-devlake] abeizn opened a new pull request, #3726: feat: refdiff adapt new commits_diffs table

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

   ### ⚠️ Pre Checklist
   
   > Please complete _ALL_ items in this checklist, and remove before submitting
   
   - [ ] I have read through the [Contributing Documentation](https://devlake.apache.org/community/).
   - [ ] I have added relevant tests.
   - [ ] I have added relevant documentation.
   - [ ] I will add labels to the PR, such as `pr-type/bug-fix`, `pr-type/feature-development`, etc.
   
   
   
   # Summary
   **to be tested**
   
   refdiff adapt new commits_diffs table
   
   ### Does this close any open issues?
   related to #3685 
   
   ### 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] abeizn commented on a diff in pull request #3726: feat: refdiff adapt new commits_diffs table

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


##########
models/migrationscripts/20221109_modfiy_commits_diffs.go:
##########
@@ -83,6 +83,7 @@ func (script *modifyCommitsDiffs) Up(basicRes core.BasicRes) errors.Error {
 			dst.CommitSha = s.CommitSha
 			dst.NewCommitSha = s.NewRefCommitSha
 			dst.OldCommitSha = s.OldRefCommitSha
+			dst.SortingIndex = s.SortingIndex

Review Comment:
   copy all data, sortingindex is the one. 



-- 
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 #3726: feat: refdiff adapt new commits_diffs table

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


##########
models/domainlayer/code/commits_diff.go:
##########
@@ -17,15 +17,22 @@ limitations under the License.
 
 package code
 
-type RefsCommitsDiff struct {
-	NewRefId        string `gorm:"primaryKey;type:varchar(255)"`
-	OldRefId        string `gorm:"primaryKey;type:varchar(255)"`
-	CommitSha       string `gorm:"primaryKey;type:varchar(40)"`
-	NewRefCommitSha string `gorm:"type:varchar(40)"`
-	OldRefCommitSha string `gorm:"type:varchar(40)"`
-	SortingIndex    int
+type CommitsDiff struct {
+	CommitSha    string `gorm:"primaryKey;type:varchar(40)"`
+	NewCommitSha string `gorm:"primaryKey;type:varchar(40)"`
+	OldCommitSha string `gorm:"primaryKey;type:varchar(40)"`
+	SortingIndex int
 }
 
-func (RefsCommitsDiff) TableName() string {
-	return "refs_commits_diffs"
+func (CommitsDiff) TableName() string {
+	return "commits_diffs"
+}
+
+type FinishedCommitsDiffs struct {
+	NewCommitSha string `gorm:"primaryKey;type:varchar(40)"`
+	OldCommitSha string `gorm:"primaryKey;type:varchar(40)"`
+}
+
+func (FinishedCommitsDiffs) TableName() string {

Review Comment:
   ref_commits_diffs -> commits_diffs and finished_commits_diffs(it records the new_commit_sha and old_commit_sha pair ). 



-- 
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 #3726: feat: refdiff adapt new commits_diffs table

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


##########
models/domainlayer/code/commits_diff.go:
##########
@@ -17,15 +17,22 @@ limitations under the License.
 
 package code
 
-type RefsCommitsDiff struct {
-	NewRefId        string `gorm:"primaryKey;type:varchar(255)"`
-	OldRefId        string `gorm:"primaryKey;type:varchar(255)"`
-	CommitSha       string `gorm:"primaryKey;type:varchar(40)"`
-	NewRefCommitSha string `gorm:"type:varchar(40)"`
-	OldRefCommitSha string `gorm:"type:varchar(40)"`
-	SortingIndex    int
+type CommitsDiff struct {
+	CommitSha    string `gorm:"primaryKey;type:varchar(40)"`
+	NewCommitSha string `gorm:"primaryKey;type:varchar(40)"`
+	OldCommitSha string `gorm:"primaryKey;type:varchar(40)"`
+	SortingIndex int
 }
 
-func (RefsCommitsDiff) TableName() string {
-	return "refs_commits_diffs"
+func (CommitsDiff) TableName() string {
+	return "commits_diffs"
+}
+
+type FinishedCommitsDiffs struct {
+	NewCommitSha string `gorm:"primaryKey;type:varchar(40)"`
+	OldCommitSha string `gorm:"primaryKey;type:varchar(40)"`
+}
+
+func (FinishedCommitsDiffs) TableName() string {

Review Comment:
   ref_commits_diffs -> commits_diffs and finished_commits_diffs(it records the new_commit_sha and old_commit_sha pair that is inserted after being successfully calculated). 



-- 
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 #3726: feat: refdiff adapt new commits_diffs table

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


##########
plugins/starrocks/utils.go:
##########
@@ -26,7 +26,7 @@ func getTablesByDomainLayer(domainLayer string) []string {
 	switch domainLayer {
 	case "code":
 		return []string{
-			"refs_commits_diffs",
+			"commits_diffs",

Review Comment:
   you are right, I will add another



-- 
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 #3726: feat: refdiff adapt new commits_diffs table

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


##########
models/domainlayer/domaininfo/domaininfo.go:
##########
@@ -41,7 +41,7 @@ func GetDomainTablesInfo() []Tabler {
 		&code.PullRequestCommit{},
 		&code.PullRequestLabel{},
 		&code.Ref{},
-		&code.RefsCommitsDiff{},
+		&code.CommitsDiff{},

Review Comment:
   same to above



-- 
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 #3726: feat: refdiff adapt new commits_diffs table

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


##########
plugins/starrocks/utils.go:
##########
@@ -26,7 +26,7 @@ func getTablesByDomainLayer(domainLayer string) []string {
 	switch domainLayer {
 	case "code":
 		return []string{
-			"refs_commits_diffs",
+			"commits_diffs",

Review Comment:
   now we split refs_commits_diffs to two tables, do we only write down one table here?



-- 
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 merged pull request #3726: feat: refdiff adapt new commits_diffs table

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


-- 
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 #3726: feat: refdiff adapt new commits_diffs table

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


##########
models/domainlayer/code/commits_diff.go:
##########
@@ -17,15 +17,22 @@ limitations under the License.
 
 package code
 
-type RefsCommitsDiff struct {
-	NewRefId        string `gorm:"primaryKey;type:varchar(255)"`
-	OldRefId        string `gorm:"primaryKey;type:varchar(255)"`
-	CommitSha       string `gorm:"primaryKey;type:varchar(40)"`
-	NewRefCommitSha string `gorm:"type:varchar(40)"`
-	OldRefCommitSha string `gorm:"type:varchar(40)"`
-	SortingIndex    int
+type CommitsDiff struct {
+	CommitSha    string `gorm:"primaryKey;type:varchar(40)"`
+	NewCommitSha string `gorm:"primaryKey;type:varchar(40)"`
+	OldCommitSha string `gorm:"primaryKey;type:varchar(40)"`
+	SortingIndex int
 }
 
-func (RefsCommitsDiff) TableName() string {
-	return "refs_commits_diffs"
+func (CommitsDiff) TableName() string {
+	return "commits_diffs"
+}
+
+type FinishedCommitsDiffs struct {
+	NewCommitSha string `gorm:"primaryKey;type:varchar(40)"`
+	OldCommitSha string `gorm:"primaryKey;type:varchar(40)"`
+}
+
+func (FinishedCommitsDiffs) TableName() string {

Review Comment:
   what is this table?



-- 
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 #3726: feat: refdiff adapt new commits_diffs table

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


##########
plugins/refdiff/tasks/commit_diff_calculator.go:
##########
@@ -69,7 +69,8 @@ func CalculateCommitsDiff(taskCtx core.SubTaskContext) errors.Error {
 	logger.Info("Create a commit node graph with node count[%d]", commitNodeGraph.Size())
 
 	// calculate diffs for commits pairs and store them into database
-	commitsDiff := &code.RefsCommitsDiff{}
+	commitsDiff := &code.CommitsDiff{}
+	finishedCommitDiff := &code.FinishedCommitsDiffs{}

Review Comment:
   still confusing with this `finishedCommitDiff`



-- 
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 #3726: feat: refdiff adapt new commits_diffs table

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


##########
models/domainlayer/code/commits_diff.go:
##########
@@ -17,15 +17,22 @@ limitations under the License.
 
 package code
 
-type RefsCommitsDiff struct {
-	NewRefId        string `gorm:"primaryKey;type:varchar(255)"`
-	OldRefId        string `gorm:"primaryKey;type:varchar(255)"`
-	CommitSha       string `gorm:"primaryKey;type:varchar(40)"`
-	NewRefCommitSha string `gorm:"type:varchar(40)"`
-	OldRefCommitSha string `gorm:"type:varchar(40)"`
-	SortingIndex    int
+type CommitsDiff struct {
+	CommitSha    string `gorm:"primaryKey;type:varchar(40)"`
+	NewCommitSha string `gorm:"primaryKey;type:varchar(40)"`
+	OldCommitSha string `gorm:"primaryKey;type:varchar(40)"`
+	SortingIndex int
 }
 
-func (RefsCommitsDiff) TableName() string {
-	return "refs_commits_diffs"
+func (CommitsDiff) TableName() string {
+	return "commits_diffs"
+}
+
+type FinishedCommitsDiffs struct {
+	NewCommitSha string `gorm:"primaryKey;type:varchar(40)"`
+	OldCommitSha string `gorm:"primaryKey;type:varchar(40)"`
+}
+
+func (FinishedCommitsDiffs) TableName() string {

Review Comment:
   The difference between this is that commits_diffs is all the data, and finish_commits_diffs is equivalent to deploying the corresponding sha.



-- 
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 #3726: feat: refdiff adapt new commits_diffs table

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


##########
models/domainlayer/code/commits_diff.go:
##########
@@ -17,15 +17,22 @@ limitations under the License.
 
 package code
 
-type RefsCommitsDiff struct {
-	NewRefId        string `gorm:"primaryKey;type:varchar(255)"`
-	OldRefId        string `gorm:"primaryKey;type:varchar(255)"`
-	CommitSha       string `gorm:"primaryKey;type:varchar(40)"`
-	NewRefCommitSha string `gorm:"type:varchar(40)"`
-	OldRefCommitSha string `gorm:"type:varchar(40)"`
-	SortingIndex    int
+type CommitsDiff struct {
+	CommitSha    string `gorm:"primaryKey;type:varchar(40)"`
+	NewCommitSha string `gorm:"primaryKey;type:varchar(40)"`
+	OldCommitSha string `gorm:"primaryKey;type:varchar(40)"`
+	SortingIndex int

Review Comment:
   what is SortingIndex?



-- 
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 #3726: feat: refdiff adapt new commits_diffs table

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


##########
plugins/refdiff/tasks/ref_issue_diff_calculator.go:
##########
@@ -53,23 +53,24 @@ func CalculateIssuesDiff(taskCtx core.SubTaskContext) errors.Error {
 		return err
 	}
 	cursor, err := db.Cursor(
-		dal.From("refs_commits_diffs"),
+		dal.From("commits_diffs"),
 		dal.Join(
 			`left join (  
         select pull_request_id as id, commit_sha from pull_request_commits 
 			left join pull_requests p on pull_request_commits.pull_request_id = p.id
 			where p.base_repo_id = ?
 			 union  
 			select id, merge_commit_sha as commit_sha from pull_requests where base_repo_id = ?) _combine_pr 
-			on _combine_pr.commit_sha = refs_commits_diffs.commit_sha`, repoId, repoId),
+			on _combine_pr.commit_sha = commits_diffs.commit_sha`, repoId, repoId),
 		dal.Join("left join pull_request_issues on pull_request_issues.pull_request_id = _combine_pr.id"),
-		dal.Join("left join refs on refs.commit_sha = refs_commits_diffs.new_ref_commit_sha"),
-		dal.Orderby("refs_commits_diffs.new_ref_id ASC"),
-		dal.Where("refs.repo_id = ? and pull_request_issues.issue_key > 0 and (refs_commits_diffs.new_ref_id, refs_commits_diffs.old_ref_id) in ?",
+		dal.Join("left join refs new_refs on new_refs.commit_sha = commits_diffs.new_commit_sha"),
+		dal.Join("left join refs old_refs on old_refs.commit_sha = commits_diffs.old_commit_sha"),
+		dal.Orderby("new_refs.id ASC"),
+		dal.Where("new_refs.repo_id = ? and pull_request_issues.issue_key > 0 and (new_refs.id, old_refs.id) in ?",
 			repoId, pairList),
-		dal.Select(`refs_commits_diffs.new_ref_commit_sha as new_ref_commit_sha, refs_commits_diffs.old_ref_commit_sha as old_ref_commit_sha, 
+		dal.Select(`commits_diffs.new_commit_sha as new_ref_commit_sha, commits_diffs.old_commit_sha as old_ref_commit_sha, 
 			pull_request_issues.issue_id as issue_id, pull_request_issues.issue_key as issue_number, 
-			refs_commits_diffs.new_ref_id as new_ref_id, refs_commits_diffs.old_ref_id as old_ref_id`),
+			new_refs.id as new_ref_id, old_refs.id as old_ref_id`),

Review Comment:
   ok



-- 
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 #3726: feat: refdiff adapt new commits_diffs table

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


##########
plugins/refdiff/tasks/commit_diff_calculator.go:
##########
@@ -34,7 +34,7 @@ func CalculateCommitsDiff(taskCtx core.SubTaskContext) errors.Error {
 	db := taskCtx.GetDal()
 	ctx := taskCtx.GetContext()
 	logger := taskCtx.GetLogger()
-	insertCountLimitOfRefsCommitsDiff := int(65535 / reflect.ValueOf(code.RefsCommitsDiff{}).NumField())
+	insertCountLimitOfCommitsDiff := int(65535 / reflect.ValueOf(code.CommitsDiff{}).NumField())

Review Comment:
   can you write some comment here?



-- 
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 #3726: feat: refdiff adapt new commits_diffs table

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


##########
models/domainlayer/domaininfo/domaininfo.go:
##########
@@ -41,7 +41,7 @@ func GetDomainTablesInfo() []Tabler {
 		&code.PullRequestCommit{},
 		&code.PullRequestLabel{},
 		&code.Ref{},
-		&code.RefsCommitsDiff{},
+		&code.CommitsDiff{},

Review Comment:
   now we split refs_commits_diffs to two tables, do we only write down one table here?



-- 
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 #3726: feat: refdiff adapt new commits_diffs table

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


##########
plugins/refdiff/tasks/commit_diff_calculator.go:
##########
@@ -69,7 +69,8 @@ func CalculateCommitsDiff(taskCtx core.SubTaskContext) errors.Error {
 	logger.Info("Create a commit node graph with node count[%d]", commitNodeGraph.Size())
 
 	// calculate diffs for commits pairs and store them into database
-	commitsDiff := &code.RefsCommitsDiff{}
+	commitsDiff := &code.CommitsDiff{}
+	finishedCommitDiff := &code.FinishedCommitsDiffs{}

Review Comment:
   same to above



-- 
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 #3726: feat: refdiff adapt new commits_diffs table

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


##########
plugins/refdiff/tasks/ref_issue_diff_calculator.go:
##########
@@ -53,23 +53,24 @@ func CalculateIssuesDiff(taskCtx core.SubTaskContext) errors.Error {
 		return err
 	}
 	cursor, err := db.Cursor(
-		dal.From("refs_commits_diffs"),
+		dal.From("commits_diffs"),
 		dal.Join(
 			`left join (  
         select pull_request_id as id, commit_sha from pull_request_commits 
 			left join pull_requests p on pull_request_commits.pull_request_id = p.id
 			where p.base_repo_id = ?
 			 union  
 			select id, merge_commit_sha as commit_sha from pull_requests where base_repo_id = ?) _combine_pr 
-			on _combine_pr.commit_sha = refs_commits_diffs.commit_sha`, repoId, repoId),
+			on _combine_pr.commit_sha = commits_diffs.commit_sha`, repoId, repoId),
 		dal.Join("left join pull_request_issues on pull_request_issues.pull_request_id = _combine_pr.id"),
-		dal.Join("left join refs on refs.commit_sha = refs_commits_diffs.new_ref_commit_sha"),
-		dal.Orderby("refs_commits_diffs.new_ref_id ASC"),
-		dal.Where("refs.repo_id = ? and pull_request_issues.issue_key > 0 and (refs_commits_diffs.new_ref_id, refs_commits_diffs.old_ref_id) in ?",
+		dal.Join("left join refs new_refs on new_refs.commit_sha = commits_diffs.new_commit_sha"),
+		dal.Join("left join refs old_refs on old_refs.commit_sha = commits_diffs.old_commit_sha"),
+		dal.Orderby("new_refs.id ASC"),
+		dal.Where("new_refs.repo_id = ? and pull_request_issues.issue_key > 0 and (new_refs.id, old_refs.id) in ?",
 			repoId, pairList),
-		dal.Select(`refs_commits_diffs.new_ref_commit_sha as new_ref_commit_sha, refs_commits_diffs.old_ref_commit_sha as old_ref_commit_sha, 
+		dal.Select(`commits_diffs.new_commit_sha as new_ref_commit_sha, commits_diffs.old_commit_sha as old_ref_commit_sha, 
 			pull_request_issues.issue_id as issue_id, pull_request_issues.issue_key as issue_number, 
-			refs_commits_diffs.new_ref_id as new_ref_id, refs_commits_diffs.old_ref_id as old_ref_id`),
+			new_refs.id as new_ref_id, old_refs.id as old_ref_id`),

Review Comment:
   I can understand this sql, but this is still too complicated, can you write some comment to explain this?



-- 
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 #3726: feat: refdiff adapt new commits_diffs table

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


##########
models/migrationscripts/20221109_modfiy_commits_diffs.go:
##########
@@ -83,6 +83,7 @@ func (script *modifyCommitsDiffs) Up(basicRes core.BasicRes) errors.Error {
 			dst.CommitSha = s.CommitSha
 			dst.NewCommitSha = s.NewRefCommitSha
 			dst.OldCommitSha = s.OldRefCommitSha
+			dst.SortingIndex = s.SortingIndex

Review Comment:
   what is this? can you add some comment here?



-- 
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 #3726: feat: refdiff adapt new commits_diffs table

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


##########
models/domainlayer/code/commits_diff.go:
##########
@@ -17,15 +17,22 @@ limitations under the License.
 
 package code
 
-type RefsCommitsDiff struct {
-	NewRefId        string `gorm:"primaryKey;type:varchar(255)"`
-	OldRefId        string `gorm:"primaryKey;type:varchar(255)"`
-	CommitSha       string `gorm:"primaryKey;type:varchar(40)"`
-	NewRefCommitSha string `gorm:"type:varchar(40)"`
-	OldRefCommitSha string `gorm:"type:varchar(40)"`
-	SortingIndex    int
+type CommitsDiff struct {
+	CommitSha    string `gorm:"primaryKey;type:varchar(40)"`
+	NewCommitSha string `gorm:"primaryKey;type:varchar(40)"`
+	OldCommitSha string `gorm:"primaryKey;type:varchar(40)"`
+	SortingIndex int
 }
 
-func (RefsCommitsDiff) TableName() string {
-	return "refs_commits_diffs"
+func (CommitsDiff) TableName() string {
+	return "commits_diffs"
+}
+
+type FinishedCommitsDiffs struct {
+	NewCommitSha string `gorm:"primaryKey;type:varchar(40)"`
+	OldCommitSha string `gorm:"primaryKey;type:varchar(40)"`
+}
+
+func (FinishedCommitsDiffs) TableName() string {

Review Comment:
   But commit_diff already have those two fields, why do we still need finished_commits_diffs?
   



-- 
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