Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type PullRequestIssue struct {
PullRequestId string `json:"id" gorm:"primaryKey;type:varchar(255);comment:This key is generated based on details from the original plugin"` // format: <Plugin>:<Entity>:<PK0>:<PK1>
IssueId string `gorm:"primaryKey;type:varchar(255)"`
PullRequestKey int
IssueKey int
IssueKey string `gorm:"type:varchar(255)"`
common.NoPKModel
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
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/plugin"
"github.com/apache/incubator-devlake/helpers/migrationhelper"
)

var _ plugin.MigrationScript = (*addCommitShaToCicdRelease)(nil)

type pullRequestIssues20240523 struct {
IssueKey string `gorm:"type:varchar(255)"`
}

func (pullRequestIssues20240523) TableName() string {
return "pull_request_issues"
}

type updateIssueKeyType struct{}

func (*updateIssueKeyType) Up(basicRes context.BasicRes) errors.Error {
return migrationhelper.AutoMigrateTables(basicRes, &pullRequestIssues20240523{})
}

func (*updateIssueKeyType) Version() uint64 {
return 20240523174200
}

func (*updateIssueKeyType) Name() string {
return "update issue_key's type in pull_request_issues"
}
1 change: 1 addition & 0 deletions backend/core/models/migrationscripts/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,6 @@ func All() []plugin.MigrationScript {
new(addSubtaskStates),
new(addCicdRelease),
new(addCommitShaToCicdRelease),
new(updateIssueKeyType),
}
}
3 changes: 2 additions & 1 deletion backend/plugins/gitee/tasks/pr_issue_convertor.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/apache/incubator-devlake/core/plugin"
helper "github.com/apache/incubator-devlake/helpers/pluginhelper/api"
"github.com/apache/incubator-devlake/plugins/gitee/models"
"github.com/spf13/cast"
"reflect"
"strconv"
)
Expand Down Expand Up @@ -66,7 +67,7 @@ func ConvertPullRequestIssues(taskCtx plugin.SubTaskContext) errors.Error {
pullRequestIssue := &crossdomain.PullRequestIssue{
PullRequestId: prIdGen.Generate(data.Options.ConnectionId, giteePrIssue.PullRequestId),
IssueId: issueIdGen.Generate(data.Options.ConnectionId, giteePrIssue.IssueId),
IssueKey: issueNum,
IssueKey: cast.ToString(issueNum),
PullRequestKey: giteePrIssue.PullRequestNumber,
}
return []interface{}{
Expand Down
3 changes: 2 additions & 1 deletion backend/plugins/github/tasks/pr_issue_convertor.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ limitations under the License.
package tasks

import (
"github.com/spf13/cast"
"reflect"

"github.com/apache/incubator-devlake/core/dal"
Expand Down Expand Up @@ -80,7 +81,7 @@ func ConvertPullRequestIssues(taskCtx plugin.SubTaskContext) errors.Error {
pullRequestIssue := &crossdomain.PullRequestIssue{
PullRequestId: prIdGen.Generate(data.Options.ConnectionId, githubPrIssue.PullRequestId),
IssueId: issueIdGen.Generate(data.Options.ConnectionId, githubPrIssue.IssueId),
IssueKey: githubPrIssue.IssueNumber,
IssueKey: cast.ToString(githubPrIssue.IssueNumber),
PullRequestKey: githubPrIssue.PullRequestNumber,
}
return []interface{}{
Expand Down