From f3dea6c22658e93c43894a4068dc347ce242b46e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 5 Mar 2024 16:44:07 +0800 Subject: [PATCH] fix: modify deployable_commit_title from varchar255 to text (#7106) (#7110) Co-authored-by: abeizn --- backend/plugins/gitlab/models/deployment.go | 2 +- ...305_modify_deployment_commit_title_type.go | 48 +++++++++++++++++++ .../models/migrationscripts/register.go | 1 + 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 backend/plugins/gitlab/models/migrationscripts/20240305_modify_deployment_commit_title_type.go diff --git a/backend/plugins/gitlab/models/deployment.go b/backend/plugins/gitlab/models/deployment.go index cc79c07f53b..06b7067ee45 100644 --- a/backend/plugins/gitlab/models/deployment.go +++ b/backend/plugins/gitlab/models/deployment.go @@ -46,7 +46,7 @@ type GitlabDeployment struct { DeployableCommitID string `json:"deployable_commit_id" 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)"` + DeployableCommitTitle string `json:"deployable_commit_title"` //DeployableCoverage any `json:"deployable_coverage"` DeployableCreatedAt *time.Time `json:"deployable_created_at"` diff --git a/backend/plugins/gitlab/models/migrationscripts/20240305_modify_deployment_commit_title_type.go b/backend/plugins/gitlab/models/migrationscripts/20240305_modify_deployment_commit_title_type.go new file mode 100644 index 00000000000..b6a9ceadec8 --- /dev/null +++ b/backend/plugins/gitlab/models/migrationscripts/20240305_modify_deployment_commit_title_type.go @@ -0,0 +1,48 @@ +/* +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" +) + +var _ plugin.MigrationScript = (*modifyDeploymentCommitTitle)(nil) + +type modifyDeploymentCommitTitle struct{} + +type deployment20240305 struct { + DeployableCommitTitle string `json:"deployable_commit_title"` +} + +func (deployment20240305) TableName() string { + return "_tool_gitlab_deployments" +} + +func (script *modifyDeploymentCommitTitle) Up(basicRes context.BasicRes) errors.Error { + return basicRes.GetDal().AutoMigrate(&deployment20240305{}) +} + +func (*modifyDeploymentCommitTitle) Version() uint64 { + return 20240305155129 +} + +func (*modifyDeploymentCommitTitle) Name() string { + return "modify _tool_gitlab_deployments deployable_commit_title from varchar to text" +} diff --git a/backend/plugins/gitlab/models/migrationscripts/register.go b/backend/plugins/gitlab/models/migrationscripts/register.go index c82c09db3cf..0ec89372777 100644 --- a/backend/plugins/gitlab/models/migrationscripts/register.go +++ b/backend/plugins/gitlab/models/migrationscripts/register.go @@ -45,5 +45,6 @@ func All() []plugin.MigrationScript { new(addQueuedDuration20231129), new(modifyDeploymentMessageType), new(addTimeToGitlabPipelineProject), + new(modifyDeploymentCommitTitle), } }