From e0810f7b84ec16b2ee500ff10c15c520dbbd914b Mon Sep 17 00:00:00 2001 From: Dan Crews Date: Tue, 17 Feb 2026 13:26:08 -0800 Subject: [PATCH 1/2] fix: modify cicd_deployments name from varchar to text --- .../domainlayer/devops/cicd_deployment.go | 2 +- ...0250217_modify_cicd_deployments_to_text.go | 66 +++++++++++++++++++ .../core/models/migrationscripts/register.go | 1 + 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 backend/core/models/migrationscripts/20250217_modify_cicd_deployments_to_text.go diff --git a/backend/core/models/domainlayer/devops/cicd_deployment.go b/backend/core/models/domainlayer/devops/cicd_deployment.go index b3071077253..e1f9049ded6 100644 --- a/backend/core/models/domainlayer/devops/cicd_deployment.go +++ b/backend/core/models/domainlayer/devops/cicd_deployment.go @@ -24,7 +24,7 @@ import ( type CICDDeployment struct { domainlayer.DomainEntity CicdScopeId string `gorm:"index;type:varchar(255)"` - Name string `gorm:"type:varchar(255)"` + Name string `gorm:"type:text"` DisplayTitle string Url string Result string `gorm:"type:varchar(100)"` diff --git a/backend/core/models/migrationscripts/20250217_modify_cicd_deployments_to_text.go b/backend/core/models/migrationscripts/20250217_modify_cicd_deployments_to_text.go new file mode 100644 index 00000000000..696d63a8136 --- /dev/null +++ b/backend/core/models/migrationscripts/20250217_modify_cicd_deployments_to_text.go @@ -0,0 +1,66 @@ +/* +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/dal" + "github.com/apache/incubator-devlake/core/errors" + "github.com/apache/incubator-devlake/core/plugin" + "github.com/apache/incubator-devlake/helpers/migrationhelper" +) + +var _ plugin.MigrationScript = (*modifyCicdDeploymentsToText)(nil) + +type modifyCicdDeploymentsToText struct{} + +type cicdDeployment20250217 struct { + Name string +} + +func (cicdDeployment20250217) TableName() string { + return "cicd_deployments" +} + +func (script *modifyCicdDeploymentsToText) Up(basicRes context.BasicRes) errors.Error { + // cicd_deployments.name might be text, we ought to change the type + // for the column from `varchar(255)` to `text` + db := basicRes.GetDal() + return migrationhelper.ChangeColumnsType[cicdDeployment20250217]( + basicRes, + script, + cicdDeployment20250217{}.TableName(), + []string{"name"}, + func(tmpColumnParams []interface{}) errors.Error { + return db.UpdateColumn( + &cicdDeployment20250217{}, + "name", + dal.DalClause{Expr: " ? ", Params: tmpColumnParams}, + dal.Where("? != '' ", tmpColumnParams...), + ) + }, + ) +} + +func (*modifyCicdDeploymentsToText) Version() uint64 { + return 20250217145125 +} + +func (*modifyCicdDeploymentsToText) Name() string { + return "modify cicd_deployments name from varchar to text" +} diff --git a/backend/core/models/migrationscripts/register.go b/backend/core/models/migrationscripts/register.go index 363de1b5e3f..5b682b66222 100644 --- a/backend/core/models/migrationscripts/register.go +++ b/backend/core/models/migrationscripts/register.go @@ -141,5 +141,6 @@ func All() []plugin.MigrationScript { new(addIssueFixVerion), new(addPipelinePriority), new(fixNullPriority), + new(modifyCicdDeploymentsToText), } } From fead63c1ff9d9f45230a958c3e7a9eb684f09786 Mon Sep 17 00:00:00 2001 From: Dan Crews Date: Tue, 3 Mar 2026 11:14:20 -0800 Subject: [PATCH 2/2] fix: update the year --- ...o => 20260217_modify_cicd_deployments_to_text.go} | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) rename backend/core/models/migrationscripts/{20250217_modify_cicd_deployments_to_text.go => 20260217_modify_cicd_deployments_to_text.go} (88%) diff --git a/backend/core/models/migrationscripts/20250217_modify_cicd_deployments_to_text.go b/backend/core/models/migrationscripts/20260217_modify_cicd_deployments_to_text.go similarity index 88% rename from backend/core/models/migrationscripts/20250217_modify_cicd_deployments_to_text.go rename to backend/core/models/migrationscripts/20260217_modify_cicd_deployments_to_text.go index 696d63a8136..348099cea94 100644 --- a/backend/core/models/migrationscripts/20250217_modify_cicd_deployments_to_text.go +++ b/backend/core/models/migrationscripts/20260217_modify_cicd_deployments_to_text.go @@ -29,11 +29,11 @@ var _ plugin.MigrationScript = (*modifyCicdDeploymentsToText)(nil) type modifyCicdDeploymentsToText struct{} -type cicdDeployment20250217 struct { +type cicdDeployment20260217 struct { Name string } -func (cicdDeployment20250217) TableName() string { +func (cicdDeployment20260217) TableName() string { return "cicd_deployments" } @@ -41,14 +41,14 @@ func (script *modifyCicdDeploymentsToText) Up(basicRes context.BasicRes) errors. // cicd_deployments.name might be text, we ought to change the type // for the column from `varchar(255)` to `text` db := basicRes.GetDal() - return migrationhelper.ChangeColumnsType[cicdDeployment20250217]( + return migrationhelper.ChangeColumnsType[cicdDeployment20260217]( basicRes, script, - cicdDeployment20250217{}.TableName(), + cicdDeployment20260217{}.TableName(), []string{"name"}, func(tmpColumnParams []interface{}) errors.Error { return db.UpdateColumn( - &cicdDeployment20250217{}, + &cicdDeployment20260217{}, "name", dal.DalClause{Expr: " ? ", Params: tmpColumnParams}, dal.Where("? != '' ", tmpColumnParams...), @@ -58,7 +58,7 @@ func (script *modifyCicdDeploymentsToText) Up(basicRes context.BasicRes) errors. } func (*modifyCicdDeploymentsToText) Version() uint64 { - return 20250217145125 + return 20260217145125 } func (*modifyCicdDeploymentsToText) Name() string {