Skip to content

Commit

Permalink
fix(framework): remove deprecated fields in domain layer (apache#6393)
Browse files Browse the repository at this point in the history
* fix(framework): remove deprecated fields in domain layer

* fix(framework): fix typo

* refactor(framework): remove Position from backend

* fix(gitlab): fix e2e test
  • Loading branch information
d4x1 committed Nov 3, 2023
1 parent 1059572 commit 0985f68
Show file tree
Hide file tree
Showing 14 changed files with 163 additions and 132 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ type PullRequestComment struct {
AccountId string `gorm:"type:varchar(255)"`
CreatedDate time.Time
CommitSha string `gorm:"type:varchar(255)"`
Position int
Type string `gorm:"type:varchar(255)"`
ReviewId string `gorm:"type:varchar(255)"`
Status string `gorm:"type:varchar(255)"`
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
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 (
"github.com/apache/incubator-devlake/core/context"
"github.com/apache/incubator-devlake/core/errors"
"github.com/apache/incubator-devlake/core/models/migrationscripts/archived"
)

type removePositionFromPullRequestComments struct{}

func (u *removePositionFromPullRequestComments) Up(basicRes context.BasicRes) errors.Error {
return basicRes.GetDal().DropColumns(archived.PullRequestComment{}.TableName(), "position")
}

func (*removePositionFromPullRequestComments) Version() uint64 {
return 20231103102700
}

func (*removePositionFromPullRequestComments) Name() string {
return "remove position field from pull_request_comments"
}
1 change: 1 addition & 0 deletions backend/core/models/migrationscripts/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,6 @@ func All() []plugin.MigrationScript {
new(normalizeBpSettings),
new(addSyncPolicy),
new(addIssueCustomArrayField),
new(removePositionFromPullRequestComments),
}
}
1 change: 0 additions & 1 deletion backend/plugins/bitbucket/e2e/comment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ func TestCommentDataFlow(t *testing.T) {
"body",
"account_id",
"commit_sha",
"position",
"type",
"review_id",
"status",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
id,pull_request_id,body,account_id,commit_sha,position,type,review_id,status,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark
bitbucket:BitbucketPrComment:1:323119643,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:54,this is test014,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,0,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,14,
bitbucket:BitbucketPrComment:1:323119662,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:54,feafjae,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,0,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,15,
id,pull_request_id,body,account_id,commit_sha,type,review_id,status,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark
bitbucket:BitbucketPrComment:1:323119643,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:54,this is test014,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,14,
bitbucket:BitbucketPrComment:1:323119662,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:54,feafjae,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,15,
bitbucket:BitbucketPrComment:1:323119730,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:57,"fejoiafjoej

‌",bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,0,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,17,
bitbucket:BitbucketPrComment:1:323119743,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:57,fjeafojeoirjgoar,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,0,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,18,
bitbucket:BitbucketPrComment:1:323119784,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:51,fejoafefewa,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,0,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,12,
bitbucket:BitbucketPrComment:1:323119790,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:51,feafeogioehrw,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,0,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,13,
bitbucket:BitbucketPrComment:1:323119842,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:42,feafoegoaweoir,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,0,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,8,
bitbucket:BitbucketPrComment:1:323119856,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:42,boroehruheorefe,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,0,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,9,
bitbucket:BitbucketPrComment:1:323119897,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:54,feajfweofjwvgrea,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,0,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,16,
bitbucket:BitbucketPrComment:1:323119960,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:38,regrioteothro,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,0,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,4,
bitbucket:BitbucketPrComment:1:323119980,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:38,goeotbioebhotn,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,0,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,5,
bitbucket:BitbucketPrComment:1:323120091,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:44,feawrjoiw,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,0,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,10,
bitbucket:BitbucketPrComment:1:323120101,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:44,bbeirobeoiahoa,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,0,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,11,
bitbucket:BitbucketPrComment:1:323120140,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:40,evbnoera,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,0,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,6,
bitbucket:BitbucketPrComment:1:323120196,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:41,vobreia,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,0,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,7,
bitbucket:BitbucketPrComment:1:323120278,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:31,baroboerhba,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,0,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,1,
bitbucket:BitbucketPrComment:1:323120296,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:31,bweiwbeanb,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,0,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,2,
bitbucket:BitbucketPrComment:1:323120311,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:31,jbirobsore,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,0,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,3,
‌",bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,17,
bitbucket:BitbucketPrComment:1:323119743,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:57,fjeafojeoirjgoar,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,18,
bitbucket:BitbucketPrComment:1:323119784,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:51,fejoafefewa,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,12,
bitbucket:BitbucketPrComment:1:323119790,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:51,feafeogioehrw,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,13,
bitbucket:BitbucketPrComment:1:323119842,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:42,feafoegoaweoir,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,8,
bitbucket:BitbucketPrComment:1:323119856,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:42,boroehruheorefe,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,9,
bitbucket:BitbucketPrComment:1:323119897,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:54,feajfweofjwvgrea,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,16,
bitbucket:BitbucketPrComment:1:323119960,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:38,regrioteothro,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,4,
bitbucket:BitbucketPrComment:1:323119980,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:38,goeotbioebhotn,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,5,
bitbucket:BitbucketPrComment:1:323120091,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:44,feawrjoiw,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,10,
bitbucket:BitbucketPrComment:1:323120101,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:44,bbeirobeoiahoa,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,11,
bitbucket:BitbucketPrComment:1:323120140,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:40,evbnoera,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,6,
bitbucket:BitbucketPrComment:1:323120196,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:41,vobreia,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,7,
bitbucket:BitbucketPrComment:1:323120278,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:31,baroboerhba,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,1,
bitbucket:BitbucketPrComment:1:323120296,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:31,bweiwbeanb,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,2,
bitbucket:BitbucketPrComment:1:323120311,bitbucket:BitbucketPullRequest:1:likyh/likyhphp:31,jbirobsore,bitbucket:BitbucketAccount:1:62abf394192edb006fa0e8cf,,pullrequest_comment,,,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pull_request_comments,3,
1 change: 0 additions & 1 deletion backend/plugins/bitbucket/tasks/pr_comment_convertor.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ func ConvertPullRequestComments(taskCtx plugin.SubTaskContext) errors.Error {
Body: prComment.Body,
Type: prComment.Type,
CommitSha: "",
Position: 0,
}
return []interface{}{
domainPrComment,
Expand Down
1 change: 0 additions & 1 deletion backend/plugins/gitee/tasks/pr_comment_convertor.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ func ConvertPullRequestComments(taskCtx plugin.SubTaskContext) errors.Error {
AccountId: accountIdGen.Generate(data.Options.ConnectionId, giteePullRequestComment.AuthorUserId),
CreatedDate: giteePullRequestComment.GiteeCreatedAt,
CommitSha: "",
Position: 0,
}
return []interface{}{
domainPrComment,
Expand Down
1 change: 0 additions & 1 deletion backend/plugins/github/e2e/comment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ func TestCommentDataFlow(t *testing.T) {
"account_id",
"created_date",
"commit_sha",
"position",
"type",
"review_id",
"status",
Expand Down
1 change: 0 additions & 1 deletion backend/plugins/github/e2e/pr_review_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ func TestPrReviewDataFlow(t *testing.T) {
"account_id",
"created_date",
"commit_sha",
"position",
"type",
"review_id",
"status",
Expand Down
Loading

0 comments on commit 0985f68

Please sign in to comment.