This is an automated email from the ASF dual-hosted git repository. klesh pushed a commit to branch kw-7852-components-field-length in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
commit e006d21b3709ffdcd4bc29ff28bc2c72f30440be Author: Klesh Wong <[email protected]> AuthorDate: Tue Aug 13 16:05:05 2024 +0800 fix: change gitlab issue components field to text --- backend/plugins/gitlab/models/issue.go | 2 +- .../20240813_change_issue_component_type.go | 40 ++++++++++++++++++++++ .../gitlab/models/migrationscripts/register.go | 1 + 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/backend/plugins/gitlab/models/issue.go b/backend/plugins/gitlab/models/issue.go index 5d57d6806..36d66b5cd 100644 --- a/backend/plugins/gitlab/models/issue.go +++ b/backend/plugins/gitlab/models/issue.go @@ -45,7 +45,7 @@ type GitlabIssue struct { GitlabCreatedAt time.Time GitlabUpdatedAt time.Time `gorm:"index"` Severity string `gorm:"type:varchar(255)"` - Component string `gorm:"type:varchar(255)"` + Component string `gorm:"type:text"` TimeEstimate *int64 TotalTimeSpent *int64 common.NoPKModel diff --git a/backend/plugins/gitlab/models/migrationscripts/20240813_change_issue_component_type.go b/backend/plugins/gitlab/models/migrationscripts/20240813_change_issue_component_type.go new file mode 100644 index 000000000..08c88ac29 --- /dev/null +++ b/backend/plugins/gitlab/models/migrationscripts/20240813_change_issue_component_type.go @@ -0,0 +1,40 @@ +/* +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 = (*changeIssueComponentType)(nil) + +type changeIssueComponentType struct{} + +func (script *changeIssueComponentType) Up(basicRes context.BasicRes) errors.Error { + return basicRes.GetDal().ModifyColumnType("_tool_gitlab_issues", "components", "text") +} + +func (*changeIssueComponentType) Version() uint64 { + return 20240813154323 +} + +func (*changeIssueComponentType) Name() string { + return "change _tool_gitlab_issues.components type to text" +} diff --git a/backend/plugins/gitlab/models/migrationscripts/register.go b/backend/plugins/gitlab/models/migrationscripts/register.go index 24af299b0..8fda16c47 100644 --- a/backend/plugins/gitlab/models/migrationscripts/register.go +++ b/backend/plugins/gitlab/models/migrationscripts/register.go @@ -50,5 +50,6 @@ func All() []plugin.MigrationScript { new(addWebUrlToGitlabPipelineProject), new(addGitlabAssignee), new(addGitlabAssigneeAndReviewerPrimaryKey), + new(changeIssueComponentType), } }
