From b4e0e77999684a5c3f0e9fd243b6ee6df2891c25 Mon Sep 17 00:00:00 2001 From: abeizn Date: Thu, 19 Sep 2024 09:59:36 +0800 Subject: [PATCH] fix: increase cq_issuescomponent length to text --- .../domainlayer/codequality/cq_issues.go | 2 +- ...0919_increase_cq_issue_component_length.go | 40 +++++++++++++++++++ .../core/models/migrationscripts/register.go | 1 + 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 backend/core/models/migrationscripts/20240919_increase_cq_issue_component_length.go diff --git a/backend/core/models/domainlayer/codequality/cq_issues.go b/backend/core/models/domainlayer/codequality/cq_issues.go index 6f5d2a465e8..6856b8f7cbb 100644 --- a/backend/core/models/domainlayer/codequality/cq_issues.go +++ b/backend/core/models/domainlayer/codequality/cq_issues.go @@ -26,7 +26,7 @@ type CqIssue struct { domainlayer.DomainEntity Rule string `gorm:"type:varchar(255)"` Severity string `gorm:"type:varchar(100)"` - Component string `gorm:"type:varchar(255)"` + Component string ProjectKey string `gorm:"index;type:varchar(100)"` //domain project key Line int Status string `gorm:"type:varchar(20)"` diff --git a/backend/core/models/migrationscripts/20240919_increase_cq_issue_component_length.go b/backend/core/models/migrationscripts/20240919_increase_cq_issue_component_length.go new file mode 100644 index 00000000000..aa1483e0686 --- /dev/null +++ b/backend/core/models/migrationscripts/20240919_increase_cq_issue_component_length.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 = (*increaseCqIssueComponentLength)(nil) + +type increaseCqIssueComponentLength struct{} + +func (script *increaseCqIssueComponentLength) Up(basicRes context.BasicRes) errors.Error { + return basicRes.GetDal().ModifyColumnType("cq_issues", "component", "text") +} + +func (*increaseCqIssueComponentLength) Version() uint64 { + return 20240919160242 +} + +func (*increaseCqIssueComponentLength) Name() string { + return "increase cq_issues.component length to text" +} diff --git a/backend/core/models/migrationscripts/register.go b/backend/core/models/migrationscripts/register.go index fa349d6b3b4..709099d59b7 100644 --- a/backend/core/models/migrationscripts/register.go +++ b/backend/core/models/migrationscripts/register.go @@ -133,5 +133,6 @@ func All() []plugin.MigrationScript { new(addAssigneeToIncident), new(addIsSubtaskToIssue), new(addIsChildToCicdPipeline), + new(increaseCqIssueComponentLength), } }