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

abeizn pushed a commit to branch fix#6455
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/fix#6455 by this push:
     new 31e9aca80 fix: gitlab Deployable.Commit.Message can be bigger than 255
31e9aca80 is described below

commit 31e9aca80b9bd4d1cb3b6107a2e22ef315246c13
Author: abeizn <[email protected]>
AuthorDate: Thu Dec 7 16:22:02 2023 +0800

    fix: gitlab Deployable.Commit.Message can be bigger than 255
---
 backend/plugins/gitlab/models/deployment.go        |  5 ++-
 ... => 20231207_modify_deployment_message_type.go} | 47 +++++++++++-----------
 .../gitlab/models/migrationscripts/register.go     |  1 +
 3 files changed, 28 insertions(+), 25 deletions(-)

diff --git a/backend/plugins/gitlab/models/deployment.go 
b/backend/plugins/gitlab/models/deployment.go
index 8ae762277..858f2bc21 100644
--- a/backend/plugins/gitlab/models/deployment.go
+++ b/backend/plugins/gitlab/models/deployment.go
@@ -18,8 +18,9 @@ limitations under the License.
 package models
 
 import (
-       "github.com/apache/incubator-devlake/core/models/common"
        "time"
+
+       "github.com/apache/incubator-devlake/core/models/common"
 )
 
 type GitlabDeployment struct {
@@ -43,7 +44,7 @@ type GitlabDeployment struct {
        DeployableCommitAuthorName  string    
`json:"deployable_commit_author_name" gorm:"type:varchar(255)"`
        DeployableCommitCreatedAt   time.Time 
`json:"deployable_commit_created_at"`
        DeployableCommitID          string    `json:"deployable_commit_id" 
gorm:"type:varchar(255)"`
-       DeployableCommitMessage     string    `json:"deployable_commit_message" 
gorm:"type:varchar(255)"`
+       DeployableCommitMessage     string    `json:"deployable_commit_message"`
        DeployableCommitShortID     string    
`json:"deployable_commit_short_id" gorm:"type:varchar(255)"`
        DeployableCommitTitle       string    `json:"deployable_commit_title" 
gorm:"type:varchar(255)"`
 
diff --git a/backend/plugins/gitlab/models/migrationscripts/register.go 
b/backend/plugins/gitlab/models/migrationscripts/20231207_modify_deployment_message_type.go
similarity index 52%
copy from backend/plugins/gitlab/models/migrationscripts/register.go
copy to 
backend/plugins/gitlab/models/migrationscripts/20231207_modify_deployment_message_type.go
index d8c114416..a4e729960 100644
--- a/backend/plugins/gitlab/models/migrationscripts/register.go
+++ 
b/backend/plugins/gitlab/models/migrationscripts/20231207_modify_deployment_message_type.go
@@ -18,30 +18,31 @@ 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"
 )
 
-// All return all the migration scripts
-func All() []plugin.MigrationScript {
-       return []plugin.MigrationScript{
-               new(addInitTables),
-               new(addGitlabCI),
-               new(addPipelineID),
-               new(addPipelineProjects),
-               new(fixDurationToFloat8),
-               new(addTransformationRule20221125),
-               new(addStdTypeToIssue221230),
-               new(addIsDetailRequired20230210),
-               new(addConnectionIdToTransformationRule),
-               new(addGitlabCommitAuthorInfo),
-               new(addTypeEnvToPipeline),
-               new(renameTr2ScopeConfig),
-               new(addGitlabIssueAssignee),
-               new(addMrCommitSha),
-               new(addRawParamTableForScope),
-               new(addProjectArchived),
-               new(addDeployment),
-               new(addEnvNamePattern),
-               new(addQueuedDuration20231129),
-       }
+var _ plugin.MigrationScript = (*modifyDeploymentMessageType)(nil)
+
+type modifyDeploymentMessageType struct{}
+
+type deployment20231207 struct {
+       DeployableCommitMessage string `json:"deployable_commit_message"`
+}
+
+func (deployment20231207) TableName() string {
+       return "_tool_gitlab_deployments"
+}
+
+func (script *modifyDeploymentMessageType) Up(basicRes context.BasicRes) 
errors.Error {
+       return basicRes.GetDal().AutoMigrate(&deployment20231207{})
+}
+
+func (*modifyDeploymentMessageType) Version() uint64 {
+       return 20231205155129
+}
+
+func (*modifyDeploymentMessageType) Name() string {
+       return "modify _tool_gitlab_deployments deployable_commit_message from 
varchar to text"
 }
diff --git a/backend/plugins/gitlab/models/migrationscripts/register.go 
b/backend/plugins/gitlab/models/migrationscripts/register.go
index d8c114416..01152d1b6 100644
--- a/backend/plugins/gitlab/models/migrationscripts/register.go
+++ b/backend/plugins/gitlab/models/migrationscripts/register.go
@@ -43,5 +43,6 @@ func All() []plugin.MigrationScript {
                new(addDeployment),
                new(addEnvNamePattern),
                new(addQueuedDuration20231129),
+               new(modifyDeploymentMessageType),
        }
 }

Reply via email to