You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ab...@apache.org on 2023/12/07 08:34:00 UTC

(incubator-devlake) branch release-v0.20 updated: fix: gitlab Deployable.Commit.Message can be bigger than 255 (#6588)

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

abeizn pushed a commit to branch release-v0.20
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/release-v0.20 by this push:
     new 89f2cc842 fix: gitlab Deployable.Commit.Message can be bigger than 255 (#6588)
89f2cc842 is described below

commit 89f2cc842497b84007b494b234b554bfff35bd35
Author: abeizn <zi...@merico.dev>
AuthorDate: Thu Dec 7 16:30:20 2023 +0800

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

diff --git a/backend/plugins/gitlab/models/deployment.go b/backend/plugins/gitlab/models/deployment.go
index 2eb353b4c..c2dad5d46 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 49dce25c2..961ccef06 100644
--- a/backend/plugins/gitlab/models/migrationscripts/register.go
+++ b/backend/plugins/gitlab/models/migrationscripts/20231207_modify_deployment_message_type.go
@@ -18,29 +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),
-	}
+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 20231207155129
+}
+
+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 49dce25c2..22676f8fb 100644
--- a/backend/plugins/gitlab/models/migrationscripts/register.go
+++ b/backend/plugins/gitlab/models/migrationscripts/register.go
@@ -42,5 +42,6 @@ func All() []plugin.MigrationScript {
 		new(addProjectArchived),
 		new(addDeployment),
 		new(addEnvNamePattern),
+		new(modifyDeploymentMessageType),
 	}
 }