This is an automated email from the ASF dual-hosted git repository.

warren pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit e5add0cc8bf8d6b3fb43334d8ef8a1d31cb54e60
Author: abeizn <[email protected]>
AuthorDate: Fri May 27 18:04:36 2022 +0800

    fix: some database fields are not compliant
---
 models/domainlayer/code/pull_request.go            |  2 +-
 models/domainlayer/ticket/changelog.go             |  4 +-
 models/migrationscripts/register.go                |  3 +-
 .../updateSchemas20220526.go}                      | 32 +++++++++++--
 .../updateSchemas20220527.go}                      | 38 ++++++++++++++--
 plugins/github/tasks/pr_convertor.go               |  2 +-
 plugins/jira/jira.go                               |  3 ++
 plugins/jira/models/changelog.go                   |  4 +-
 plugins/jira/models/issue.go                       |  2 +-
 .../models/migrationscripts/archived/changelog.go  |  8 ++--
 .../updateSchemas20220525.go}                      | 37 ++++++++++++---
 .../updateSchemas20220526.go}                      | 36 ++++++++++++---
 .../changelog.go => updateSchemas20220527.go}      | 52 +++++++++++++---------
 plugins/jira/models/project.go                     |  2 +-
 plugins/jira/tasks/apiv2models/changelog.go        | 16 +++----
 plugins/jira/tasks/apiv2models/issue.go            |  2 +-
 plugins/jira/tasks/apiv2models/project.go          |  2 +-
 plugins/jira/tasks/changelog_convertor.go          |  4 +-
 plugins/jira/tasks/issue_convertor.go              |  4 +-
 plugins/jira/tasks/sprint_issues_convertor.go      |  6 +--
 .../tasks/refs_pr_cherry_pick_calculator.go        |  2 +-
 plugins/tapd/models/changelog.go                   |  7 +--
 plugins/tapd/tasks/bug_changelog_converter.go      |  4 +-
 plugins/tapd/tasks/story_changelog_converter.go    |  9 ++--
 plugins/tapd/tasks/task_changelog_converter.go     |  9 ++--
 25 files changed, 205 insertions(+), 85 deletions(-)

diff --git a/models/domainlayer/code/pull_request.go 
b/models/domainlayer/code/pull_request.go
index 81d40443..3a246412 100644
--- a/models/domainlayer/code/pull_request.go
+++ b/models/domainlayer/code/pull_request.go
@@ -35,7 +35,7 @@ type PullRequest struct {
        AuthorName     string `gorm:"type:varchar(100)"`
        AuthorId       string `gorm:"type:varchar(100)"`
        ParentPrId     string `gorm:"index;type:varchar(100)"`
-       Key            int
+       PullRequestKey int
        CreatedDate    time.Time
        MergedDate     *time.Time
        ClosedDate     *time.Time
diff --git a/models/domainlayer/ticket/changelog.go 
b/models/domainlayer/ticket/changelog.go
index afeaf4fe..8ad5bd7e 100644
--- a/models/domainlayer/ticket/changelog.go
+++ b/models/domainlayer/ticket/changelog.go
@@ -32,7 +32,7 @@ type Changelog struct {
        AuthorName  string `gorm:"type:varchar(255)"`
        FieldId     string `gorm:"type:varchar(255)"`
        FieldName   string `gorm:"type:varchar(255)"`
-       From        string
-       To          string
+       FromValue   string
+       ToValue     string
        CreatedDate time.Time
 }
diff --git a/models/migrationscripts/register.go 
b/models/migrationscripts/register.go
index 9295fdf7..8805fdff 100644
--- a/models/migrationscripts/register.go
+++ b/models/migrationscripts/register.go
@@ -24,6 +24,7 @@ func RegisterAll() {
        migration.Register([]migration.Script{
                new(initSchemas),
                new(updateSchemas20220505), new(updateSchemas20220507), 
new(updateSchemas20220510),
-               new(updateSchemas20220513), new(updateSchemas20220524),
+               new(updateSchemas20220513), new(updateSchemas20220524), 
new(updateSchemas20220526),
+               new(updateSchemas20220527),
        }, "Framework")
 }
diff --git a/models/domainlayer/code/pull_request.go 
b/models/migrationscripts/updateSchemas20220526.go
similarity index 71%
copy from models/domainlayer/code/pull_request.go
copy to models/migrationscripts/updateSchemas20220526.go
index 81d40443..30eb450a 100644
--- a/models/domainlayer/code/pull_request.go
+++ b/models/migrationscripts/updateSchemas20220526.go
@@ -15,15 +15,18 @@ See the License for the specific language governing 
permissions and
 limitations under the License.
 */
 
-package code
+package migrationscripts
 
 import (
+       "context"
        "time"
 
        "github.com/apache/incubator-devlake/models/domainlayer"
+       "github.com/apache/incubator-devlake/models/migrationscripts/archived"
+       "gorm.io/gorm"
 )
 
-type PullRequest struct {
+type PullRequest20220526 struct {
        domainlayer.DomainEntity
        BaseRepoId     string `gorm:"index"`
        HeadRepoId     string `gorm:"index"`
@@ -35,7 +38,7 @@ type PullRequest struct {
        AuthorName     string `gorm:"type:varchar(100)"`
        AuthorId       string `gorm:"type:varchar(100)"`
        ParentPrId     string `gorm:"index;type:varchar(100)"`
-       Key            int
+       PullRequestKey int
        CreatedDate    time.Time
        MergedDate     *time.Time
        ClosedDate     *time.Time
@@ -47,3 +50,26 @@ type PullRequest struct {
        BaseCommitSha  string `gorm:"type:varchar(40)"`
        HeadCommitSha  string `gorm:"type:varchar(40)"`
 }
+
+func (PullRequest20220526) TableName() string {
+       return "pull_requests"
+}
+
+type updateSchemas20220526 struct{}
+
+func (*updateSchemas20220526) Up(ctx context.Context, db *gorm.DB) error {
+
+       err := db.Migrator().RenameColumn(archived.PullRequest{}, "key", 
"pull_request_key")
+       if err != nil {
+               return err
+       }
+       return nil
+}
+
+func (*updateSchemas20220526) Version() uint64 {
+       return 20220526000005
+}
+
+func (*updateSchemas20220526) Name() string {
+       return "update `key` columns to `pull_request_key` at pull_requests"
+}
diff --git a/models/domainlayer/ticket/changelog.go 
b/models/migrationscripts/updateSchemas20220527.go
similarity index 58%
copy from models/domainlayer/ticket/changelog.go
copy to models/migrationscripts/updateSchemas20220527.go
index afeaf4fe..1f11f0ab 100644
--- a/models/domainlayer/ticket/changelog.go
+++ b/models/migrationscripts/updateSchemas20220527.go
@@ -15,15 +15,18 @@ See the License for the specific language governing 
permissions and
 limitations under the License.
 */
 
-package ticket
+package migrationscripts
 
 import (
+       "context"
        "time"
 
        "github.com/apache/incubator-devlake/models/domainlayer"
+       "github.com/apache/incubator-devlake/models/migrationscripts/archived"
+       "gorm.io/gorm"
 )
 
-type Changelog struct {
+type Changelog20220527 struct {
        domainlayer.DomainEntity
 
        // collected fields
@@ -32,7 +35,34 @@ type Changelog struct {
        AuthorName  string `gorm:"type:varchar(255)"`
        FieldId     string `gorm:"type:varchar(255)"`
        FieldName   string `gorm:"type:varchar(255)"`
-       From        string
-       To          string
+       FromValue   string
+       ToValue     string
        CreatedDate time.Time
 }
+
+func (Changelog20220527) TableName() string {
+       return "changelogs"
+}
+
+type updateSchemas20220527 struct{}
+
+func (*updateSchemas20220527) Up(ctx context.Context, db *gorm.DB) error {
+
+       err := db.Migrator().RenameColumn(archived.Changelog{}, "from", 
"from_value")
+       if err != nil {
+               return err
+       }
+       err = db.Migrator().RenameColumn(archived.Changelog{}, "to", "to_value")
+       if err != nil {
+               return err
+       }
+       return nil
+}
+
+func (*updateSchemas20220527) Version() uint64 {
+       return 20220527000005
+}
+
+func (*updateSchemas20220527) Name() string {
+       return "update `from` and `to` columns to `from_value` and `to_value` 
at changelogs"
+}
diff --git a/plugins/github/tasks/pr_convertor.go 
b/plugins/github/tasks/pr_convertor.go
index 1b53c6ef..95732ab2 100644
--- a/plugins/github/tasks/pr_convertor.go
+++ b/plugins/github/tasks/pr_convertor.go
@@ -77,7 +77,7 @@ func ConvertPullRequests(taskCtx core.SubTaskContext) error {
                                CreatedDate:    pr.GithubCreatedAt,
                                MergedDate:     pr.MergedAt,
                                ClosedDate:     pr.ClosedAt,
-                               Key:            pr.Number,
+                               PullRequestKey: pr.Number,
                                Type:           pr.Type,
                                Component:      pr.Component,
                                MergeCommitSha: pr.MergeCommitSha,
diff --git a/plugins/jira/jira.go b/plugins/jira/jira.go
index a62f16b2..d401bd03 100644
--- a/plugins/jira/jira.go
+++ b/plugins/jira/jira.go
@@ -149,6 +149,9 @@ func (plugin Jira) MigrationScripts() []migration.Script {
                new(migrationscripts.UpdateSchemas20220505),
                new(migrationscripts.UpdateSchemas20220507),
                new(migrationscripts.UpdateSchemas20220518),
+               new(migrationscripts.UpdateSchemas20220525),
+               new(migrationscripts.UpdateSchemas20220526),
+               new(migrationscripts.UpdateSchemas20220527),
        }
 }
 
diff --git a/plugins/jira/models/changelog.go b/plugins/jira/models/changelog.go
index 9c459a92..301197cd 100644
--- a/plugins/jira/models/changelog.go
+++ b/plugins/jira/models/changelog.go
@@ -45,9 +45,9 @@ type JiraChangelogItem struct {
        Field        string `gorm:"primaryKey"`
        FieldType    string
        FieldId      string
-       From         string
+       FromValue    string
        FromString   string
-       To           string
+       ToValue      string
        ToString     string
 }
 
diff --git a/plugins/jira/models/issue.go b/plugins/jira/models/issue.go
index e6d0b96d..a727099b 100644
--- a/plugins/jira/models/issue.go
+++ b/plugins/jira/models/issue.go
@@ -31,7 +31,7 @@ type JiraIssue struct {
        ProjectId                uint64
        Self                     string `gorm:"type:varchar(255)"`
        IconURL                  string 
`gorm:"type:varchar(255);column:icon_url"`
-       Key                      string `gorm:"type:varchar(255)"`
+       IssueKey                 string `gorm:"type:varchar(255)"`
        Summary                  string
        Type                     string `gorm:"type:varchar(255)"`
        EpicKey                  string `gorm:"type:varchar(255)"`
diff --git a/plugins/jira/models/migrationscripts/archived/changelog.go 
b/plugins/jira/models/migrationscripts/archived/changelog.go
index 4b87297b..11e05ab7 100644
--- a/plugins/jira/models/migrationscripts/archived/changelog.go
+++ b/plugins/jira/models/migrationscripts/archived/changelog.go
@@ -45,10 +45,10 @@ type JiraChangelogItem struct {
        Field       string `gorm:"primaryKey"`
        FieldType   string
        FieldId     string
-       From        string
-       FromString  string
-       To          string
-       ToString    string
+       From         string
+       FromString   string
+       To           string
+       ToString     string
 }
 
 func (JiraChangelog) TableName() string {
diff --git a/plugins/jira/models/project.go 
b/plugins/jira/models/migrationscripts/updateSchemas20220525.go
similarity index 54%
copy from plugins/jira/models/project.go
copy to plugins/jira/models/migrationscripts/updateSchemas20220525.go
index 24f63db4..d3a52509 100644
--- a/plugins/jira/models/project.go
+++ b/plugins/jira/models/migrationscripts/updateSchemas20220525.go
@@ -15,22 +15,47 @@ See the License for the specific language governing 
permissions and
 limitations under the License.
 */
 
-package models
+package migrationscripts
 
 import (
-       "github.com/apache/incubator-devlake/models/common"
+       "context"
+
+       "github.com/apache/incubator-devlake/models/migrationscripts/archived"
+       jiraArchived 
"github.com/apache/incubator-devlake/plugins/jira/models/migrationscripts/archived"
+
+       "gorm.io/gorm"
 )
 
-type JiraProject struct {
-       common.NoPKModel
+type JiraProject20220525 struct {
+       archived.NoPKModel
 
        // collected fields
        ConnectionId uint64 `gorm:"primarykey"`
        Id           string `gorm:"primaryKey;type:varchar(255)"`
-       Key          string `gorm:"type:varchar(255)"`
+       ProjectKey   string `gorm:"type:varchar(255)"`
        Name         string `gorm:"type:varchar(255)"`
 }
 
-func (JiraProject) TableName() string {
+func (JiraProject20220525) TableName() string {
        return "_tool_jira_projects"
 }
+
+type UpdateSchemas20220525 struct{}
+
+func (*UpdateSchemas20220525) Up(ctx context.Context, db *gorm.DB) error {
+
+       err := db.Migrator().RenameColumn(jiraArchived.JiraProject{}, "key", 
"project_key")
+       if err != nil {
+               return err
+       }
+
+       return nil
+}
+
+func (*UpdateSchemas20220525) Version() uint64 {
+       return 20220525154646
+}
+
+func (*UpdateSchemas20220525) Name() string {
+       return "update `key` columns to `project_key` at _tool_jira_projects"
+}
diff --git a/plugins/jira/models/issue.go 
b/plugins/jira/models/migrationscripts/updateSchemas20220526.go
similarity index 77%
copy from plugins/jira/models/issue.go
copy to plugins/jira/models/migrationscripts/updateSchemas20220526.go
index e6d0b96d..b7bb634d 100644
--- a/plugins/jira/models/issue.go
+++ b/plugins/jira/models/migrationscripts/updateSchemas20220526.go
@@ -15,23 +15,27 @@ See the License for the specific language governing 
permissions and
 limitations under the License.
 */
 
-package models
+package migrationscripts
 
 import (
+       "context"
        "time"
 
-       "github.com/apache/incubator-devlake/models/common"
+       "github.com/apache/incubator-devlake/models/migrationscripts/archived"
+       jiraArchived 
"github.com/apache/incubator-devlake/plugins/jira/models/migrationscripts/archived"
+
        "gorm.io/datatypes"
+       "gorm.io/gorm"
 )
 
-type JiraIssue struct {
+type JiraIssue20220526 struct {
        // collected fields
        ConnectionId             uint64 `gorm:"primaryKey"`
        IssueId                  uint64 `gorm:"primarykey"`
        ProjectId                uint64
        Self                     string `gorm:"type:varchar(255)"`
        IconURL                  string 
`gorm:"type:varchar(255);column:icon_url"`
-       Key                      string `gorm:"type:varchar(255)"`
+       IssueKey                 string `gorm:"type:varchar(255)"`
        Summary                  string
        Type                     string `gorm:"type:varchar(255)"`
        EpicKey                  string `gorm:"type:varchar(255)"`
@@ -67,9 +71,29 @@ type JiraIssue struct {
        ChangelogUpdated  *time.Time
        RemotelinkUpdated *time.Time
        WorklogUpdated    *time.Time
-       common.NoPKModel
+       archived.NoPKModel
 }
 
-func (JiraIssue) TableName() string {
+func (JiraIssue20220526) TableName() string {
        return "_tool_jira_issues"
 }
+
+type UpdateSchemas20220526 struct{}
+
+func (*UpdateSchemas20220526) Up(ctx context.Context, db *gorm.DB) error {
+
+       err := db.Migrator().RenameColumn(jiraArchived.JiraIssue{}, "key", 
"issue_key")
+       if err != nil {
+               return err
+       }
+
+       return nil
+}
+
+func (*UpdateSchemas20220526) Version() uint64 {
+       return 20220526154646
+}
+
+func (*UpdateSchemas20220526) Name() string {
+       return "update `key` columns to `issue_key` at _tool_jira_issues"
+}
diff --git a/plugins/jira/models/migrationscripts/archived/changelog.go 
b/plugins/jira/models/migrationscripts/updateSchemas20220527.go
similarity index 56%
copy from plugins/jira/models/migrationscripts/archived/changelog.go
copy to plugins/jira/models/migrationscripts/updateSchemas20220527.go
index 4b87297b..145498dc 100644
--- a/plugins/jira/models/migrationscripts/archived/changelog.go
+++ b/plugins/jira/models/migrationscripts/updateSchemas20220527.go
@@ -15,28 +15,17 @@ See the License for the specific language governing 
permissions and
 limitations under the License.
 */
 
-package archived
+package migrationscripts
 
 import (
-       "time"
+       "context"
 
        "github.com/apache/incubator-devlake/models/migrationscripts/archived"
+       jiraArchived 
"github.com/apache/incubator-devlake/plugins/jira/models/migrationscripts/archived"
+       "gorm.io/gorm"
 )
 
-type JiraChangelog struct {
-       archived.NoPKModel
-
-       // collected fields
-       SourceId          uint64 `gorm:"primaryKey"`
-       ChangelogId       uint64 `gorm:"primarykey"`
-       IssueId           uint64 `gorm:"index"`
-       AuthorAccountId   string `gorm:"type:varchar(255)"`
-       AuthorDisplayName string `gorm:"type:varchar(255)"`
-       AuthorActive      bool
-       Created           time.Time `gorm:"index"`
-}
-
-type JiraChangelogItem struct {
+type JiraChangelogItem20220527 struct {
        archived.NoPKModel
 
        // collected fields
@@ -45,16 +34,35 @@ type JiraChangelogItem struct {
        Field       string `gorm:"primaryKey"`
        FieldType   string
        FieldId     string
-       From        string
+       FromValue   string
        FromString  string
-       To          string
+       ToValue     string
        ToString    string
 }
 
-func (JiraChangelog) TableName() string {
-       return "_tool_jira_changelogs"
+func (JiraChangelogItem20220527) TableName() string {
+       return "_tool_jira_changelog_items"
+}
+
+type UpdateSchemas20220527 struct{}
+
+func (*UpdateSchemas20220527) Up(ctx context.Context, db *gorm.DB) error {
+       
+       err := db.Migrator().RenameColumn(jiraArchived.JiraChangelogItem{}, 
"from", "from_value")
+       if err != nil {
+               return err
+       }
+       err = db.Migrator().RenameColumn(jiraArchived.JiraChangelogItem{}, 
"to", "to_value")
+       if err != nil {
+               return err
+       }
+       return nil
+}
+
+func (*UpdateSchemas20220527) Version() uint64 {
+       return 20220527154646
 }
 
-func (JiraChangelogItem) TableName() string {
-       return "_tool_jira_changelog_items"
+func (*UpdateSchemas20220527) Name() string {
+       return "update `from` and `to` columns to `from_value` and `to_value` 
at _tool_jira_changelog_items"
 }
diff --git a/plugins/jira/models/project.go b/plugins/jira/models/project.go
index 24f63db4..46446274 100644
--- a/plugins/jira/models/project.go
+++ b/plugins/jira/models/project.go
@@ -27,7 +27,7 @@ type JiraProject struct {
        // collected fields
        ConnectionId uint64 `gorm:"primarykey"`
        Id           string `gorm:"primaryKey;type:varchar(255)"`
-       Key          string `gorm:"type:varchar(255)"`
+       ProjectKey   string `gorm:"type:varchar(255)"`
        Name         string `gorm:"type:varchar(255)"`
 }
 
diff --git a/plugins/jira/tasks/apiv2models/changelog.go 
b/plugins/jira/tasks/apiv2models/changelog.go
index 7e305467..1ea50c81 100644
--- a/plugins/jira/tasks/apiv2models/changelog.go
+++ b/plugins/jira/tasks/apiv2models/changelog.go
@@ -44,9 +44,9 @@ func (c Changelog) ToToolLayer(connectionId, issueId uint64) 
(*models.JiraChange
 type ChangelogItem struct {
        Field      string `json:"field"`
        Fieldtype  string `json:"fieldtype"`
-       From       string `json:"from"`
+       FromValue  string `json:"from_value"`
        FromString string `json:"fromString"`
-       To         string `json:"to"`
+       ToValue    string `json:"to_value"`
        ToString   string `json:"toString"`
 }
 
@@ -56,9 +56,9 @@ func (c ChangelogItem) ToToolLayer(connectionId, changelogId 
uint64) *models.Jir
                ChangelogId:  changelogId,
                Field:        c.Field,
                FieldType:    c.Fieldtype,
-               From:         c.From,
+               FromValue:    c.FromValue,
                FromString:   c.FromString,
-               To:           c.To,
+               ToValue:      c.ToValue,
                ToString:     c.ToString,
        }
 }
@@ -68,11 +68,11 @@ func (c ChangelogItem) ExtractUser(connectionId uint64) 
[]*models.JiraUser {
                return nil
        }
        var result []*models.JiraUser
-       if c.From != "" {
-               result = append(result, &models.JiraUser{ConnectionId: 
connectionId, AccountId: c.From})
+       if c.FromValue != "" {
+               result = append(result, &models.JiraUser{ConnectionId: 
connectionId, AccountId: c.FromValue})
        }
-       if c.To != "" {
-               result = append(result, &models.JiraUser{ConnectionId: 
connectionId, AccountId: c.To})
+       if c.ToValue != "" {
+               result = append(result, &models.JiraUser{ConnectionId: 
connectionId, AccountId: c.ToValue})
        }
        return result
 }
diff --git a/plugins/jira/tasks/apiv2models/issue.go 
b/plugins/jira/tasks/apiv2models/issue.go
index 4377f7a3..3544150e 100644
--- a/plugins/jira/tasks/apiv2models/issue.go
+++ b/plugins/jira/tasks/apiv2models/issue.go
@@ -162,7 +162,7 @@ func (i Issue) toToolLayer(connectionId uint64, epicField, 
storyPointField strin
                ProjectId:          i.Fields.Project.ID,
                Self:               i.Self,
                IconURL:            i.Fields.Issuetype.IconURL,
-               Key:                i.Key,
+               IssueKey:           i.Key,
                StoryPoint:         workload,
                Summary:            i.Fields.Summary,
                Type:               i.Fields.Issuetype.Name,
diff --git a/plugins/jira/tasks/apiv2models/project.go 
b/plugins/jira/tasks/apiv2models/project.go
index 24d1c017..4aabd3f5 100644
--- a/plugins/jira/tasks/apiv2models/project.go
+++ b/plugins/jira/tasks/apiv2models/project.go
@@ -32,7 +32,7 @@ func (p Project) ToToolLayer(connectionId uint64) 
*models.JiraProject {
        return &models.JiraProject{
                ConnectionId: connectionId,
                Id:           p.ID,
-               Key:          p.Key,
+               ProjectKey:   p.Key,
                Name:         p.Name,
        }
 }
diff --git a/plugins/jira/tasks/changelog_convertor.go 
b/plugins/jira/tasks/changelog_convertor.go
index 6280c788..cc8be29f 100644
--- a/plugins/jira/tasks/changelog_convertor.go
+++ b/plugins/jira/tasks/changelog_convertor.go
@@ -94,8 +94,8 @@ func ConvertChangelogs(taskCtx core.SubTaskContext) error {
                                AuthorName:  row.AuthorDisplayName,
                                FieldId:     row.FieldId,
                                FieldName:   row.Field,
-                               From:        row.FromString,
-                               To:          row.ToString,
+                               FromValue:   row.FromString,
+                               ToValue:     row.ToString,
                                CreatedDate: row.Created,
                        }
                        sprintIssueConverter.FeedIn(connectionId, *row)
diff --git a/plugins/jira/tasks/issue_convertor.go 
b/plugins/jira/tasks/issue_convertor.go
index 79b39c66..f5d316c5 100644
--- a/plugins/jira/tasks/issue_convertor.go
+++ b/plugins/jira/tasks/issue_convertor.go
@@ -72,9 +72,9 @@ func ConvertIssues(taskCtx core.SubTaskContext) error {
                                DomainEntity: domainlayer.DomainEntity{
                                        Id: 
issueIdGen.Generate(jiraIssue.ConnectionId, jiraIssue.IssueId),
                                },
-                               Url:                     
convertURL(jiraIssue.Self, jiraIssue.Key),
+                               Url:                     
convertURL(jiraIssue.Self, jiraIssue.IssueKey),
                                IconURL:                 jiraIssue.IconURL,
-                               Number:                  jiraIssue.Key,
+                               Number:                  jiraIssue.IssueKey,
                                Title:                   jiraIssue.Summary,
                                EpicKey:                 jiraIssue.EpicKey,
                                Type:                    jiraIssue.StdType,
diff --git a/plugins/jira/tasks/sprint_issues_convertor.go 
b/plugins/jira/tasks/sprint_issues_convertor.go
index 647f9787..323893d8 100644
--- a/plugins/jira/tasks/sprint_issues_convertor.go
+++ b/plugins/jira/tasks/sprint_issues_convertor.go
@@ -87,7 +87,7 @@ func (c *SprintIssuesConverter) FeedIn(connectionId uint64, 
cl ChangelogItemResu
        if cl.Field != "Sprint" {
                return
        }
-       from, to, err := c.parseFromTo(cl.From, cl.To)
+       from, to, err := c.parseFromTo(cl.FromValue, cl.ToValue)
        if err != nil {
                return
        }
@@ -403,8 +403,8 @@ func (c *SprintIssuesConverter) handleAssignee(connectionId 
uint64, cl Changelog
                }
        }
        var assignee string
-       if cl.To != "" {
-               assignee = c.userIdGen.Generate(connectionId, cl.To)
+       if cl.ToValue != "" {
+               assignee = c.userIdGen.Generate(connectionId, cl.ToValue)
        }
        now := time.Now()
        c.assignee[issueId] = &ticket.IssueAssigneeHistory{
diff --git a/plugins/refdiff/tasks/refs_pr_cherry_pick_calculator.go 
b/plugins/refdiff/tasks/refs_pr_cherry_pick_calculator.go
index a8f1d786..e9fc4d45 100644
--- a/plugins/refdiff/tasks/refs_pr_cherry_pick_calculator.go
+++ b/plugins/refdiff/tasks/refs_pr_cherry_pick_calculator.go
@@ -92,7 +92,7 @@ func CalculatePrCherryPick(taskCtx core.SubTaskContext) error 
{
 
                var parentPrId string
                err = db.Model(&code.PullRequest{}).
-                       Where("key = ? and base_repo_id = ?", parentPrKeyInt, 
repoId).
+                       Where("pull_request_key = ? and base_repo_id = ?", 
parentPrKeyInt, repoId).
                        Pluck("id", &parentPrId).Error
                if err != nil {
                        return err
diff --git a/plugins/tapd/models/changelog.go b/plugins/tapd/models/changelog.go
index b14628bb..a6578dc6 100644
--- a/plugins/tapd/models/changelog.go
+++ b/plugins/tapd/models/changelog.go
@@ -18,8 +18,9 @@ limitations under the License.
 package models
 
 import (
-       "github.com/apache/incubator-devlake/models/common"
        "time"
+
+       "github.com/apache/incubator-devlake/models/common"
 )
 
 type ChangelogTmp struct {
@@ -29,8 +30,8 @@ type ChangelogTmp struct {
        AuthorName      string
        FieldId         string
        FieldName       string
-       From            string
-       To              string
+       FromValue       string
+       ToValue         string
        IterationIdFrom uint64
        IterationIdTo   uint64
        CreatedDate     time.Time
diff --git a/plugins/tapd/tasks/bug_changelog_converter.go 
b/plugins/tapd/tasks/bug_changelog_converter.go
index 4c3e2e6b..930887f4 100644
--- a/plugins/tapd/tasks/bug_changelog_converter.go
+++ b/plugins/tapd/tasks/bug_changelog_converter.go
@@ -87,8 +87,8 @@ func ConvertBugChangelog(taskCtx core.SubTaskContext) error {
                                AuthorName:  cl.Author,
                                FieldId:     cl.Field,
                                FieldName:   cl.Field,
-                               From:        cl.ValueBeforeParsed,
-                               To:          cl.ValueAfterParsed,
+                               FromValue:        cl.ValueBeforeParsed,
+                               ToValue:          cl.ValueAfterParsed,
                                CreatedDate: cl.Created,
                        }
 
diff --git a/plugins/tapd/tasks/story_changelog_converter.go 
b/plugins/tapd/tasks/story_changelog_converter.go
index af841161..cca20956 100644
--- a/plugins/tapd/tasks/story_changelog_converter.go
+++ b/plugins/tapd/tasks/story_changelog_converter.go
@@ -19,6 +19,9 @@ package tasks
 
 import (
        "fmt"
+       "reflect"
+       "time"
+
        "github.com/apache/incubator-devlake/models/common"
        "github.com/apache/incubator-devlake/models/domainlayer"
        "github.com/apache/incubator-devlake/models/domainlayer/didgen"
@@ -26,8 +29,6 @@ import (
        "github.com/apache/incubator-devlake/plugins/core"
        "github.com/apache/incubator-devlake/plugins/helper"
        "github.com/apache/incubator-devlake/plugins/tapd/models"
-       "reflect"
-       "time"
 )
 
 type StoryChangelogItemResult struct {
@@ -90,8 +91,8 @@ func ConvertStoryChangelog(taskCtx core.SubTaskContext) error 
{
                                AuthorName:  cl.Creator,
                                FieldId:     cl.Field,
                                FieldName:   cl.Field,
-                               From:        cl.ValueBeforeParsed,
-                               To:          cl.ValueAfterParsed,
+                               FromValue:   cl.ValueBeforeParsed,
+                               ToValue:     cl.ValueAfterParsed,
                                CreatedDate: cl.Created,
                        }
 
diff --git a/plugins/tapd/tasks/task_changelog_converter.go 
b/plugins/tapd/tasks/task_changelog_converter.go
index 748a8a1b..9ce44fb7 100644
--- a/plugins/tapd/tasks/task_changelog_converter.go
+++ b/plugins/tapd/tasks/task_changelog_converter.go
@@ -19,6 +19,9 @@ package tasks
 
 import (
        "fmt"
+       "reflect"
+       "time"
+
        "github.com/apache/incubator-devlake/models/common"
        "github.com/apache/incubator-devlake/models/domainlayer"
        "github.com/apache/incubator-devlake/models/domainlayer/didgen"
@@ -26,8 +29,6 @@ import (
        "github.com/apache/incubator-devlake/plugins/core"
        "github.com/apache/incubator-devlake/plugins/helper"
        "github.com/apache/incubator-devlake/plugins/tapd/models"
-       "reflect"
-       "time"
 )
 
 type TaskChangelogItemResult struct {
@@ -91,8 +92,8 @@ func ConvertTaskChangelog(taskCtx core.SubTaskContext) error {
                                AuthorName:  cl.Creator,
                                FieldId:     cl.Field,
                                FieldName:   cl.Field,
-                               From:        cl.ValueBeforeParsed,
-                               To:          cl.ValueAfterParsed,
+                               FromValue:   cl.ValueBeforeParsed,
+                               ToValue:     cl.ValueAfterParsed,
                                CreatedDate: cl.Created,
                        }
 

Reply via email to