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

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


The following commit(s) were added to refs/heads/main by this push:
     new b7c190d13 fix: modify cicd_deployments name from varchar to text 
(#8724)
b7c190d13 is described below

commit b7c190d1325ace9dc0d5027fe42cde8ca8a1c81c
Author: Dan Crews <[email protected]>
AuthorDate: Thu Mar 5 06:05:20 2026 -0800

    fix: modify cicd_deployments name from varchar to text (#8724)
    
    * fix: modify cicd_deployments name from varchar to text
    
    * fix: update the year
---
 .../models/domainlayer/devops/cicd_deployment.go   |  2 +-
 .../20260217_modify_cicd_deployments_to_text.go    | 66 ++++++++++++++++++++++
 backend/core/models/migrationscripts/register.go   |  1 +
 3 files changed, 68 insertions(+), 1 deletion(-)

diff --git a/backend/core/models/domainlayer/devops/cicd_deployment.go 
b/backend/core/models/domainlayer/devops/cicd_deployment.go
index b30710772..e1f9049de 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/20260217_modify_cicd_deployments_to_text.go
 
b/backend/core/models/migrationscripts/20260217_modify_cicd_deployments_to_text.go
new file mode 100644
index 000000000..348099cea
--- /dev/null
+++ 
b/backend/core/models/migrationscripts/20260217_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 cicdDeployment20260217 struct {
+       Name string
+}
+
+func (cicdDeployment20260217) 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[cicdDeployment20260217](
+               basicRes,
+               script,
+               cicdDeployment20260217{}.TableName(),
+               []string{"name"},
+               func(tmpColumnParams []interface{}) errors.Error {
+                       return db.UpdateColumn(
+                               &cicdDeployment20260217{},
+                               "name",
+                               dal.DalClause{Expr: " ? ", Params: 
tmpColumnParams},
+                               dal.Where("? != '' ", tmpColumnParams...),
+                       )
+               },
+       )
+}
+
+func (*modifyCicdDeploymentsToText) Version() uint64 {
+       return 20260217145125
+}
+
+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 363de1b5e..5b682b662 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),
        }
 }

Reply via email to