Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/core/models/domainlayer/devops/cicd_deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)"`
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
}
1 change: 1 addition & 0 deletions backend/core/models/migrationscripts/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,5 +141,6 @@ func All() []plugin.MigrationScript {
new(addIssueFixVerion),
new(addPipelinePriority),
new(fixNullPriority),
new(modifyCicdDeploymentsToText),
}
}
Loading