Skip to content

Commit af806ee

Browse files
jbsmith7741tamas-la
authored andcommitted
fix(sonarqube): increase cq_issues and cq_file_metrics project_key length to 500 (#8783)
Fixes #8331
1 parent 5011727 commit af806ee

4 files changed

Lines changed: 47 additions & 2 deletions

File tree

backend/core/models/domainlayer/codequality/cq_file_metrics.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323

2424
type CqFileMetrics struct {
2525
domainlayer.DomainEntity
26-
ProjectKey string `gorm:"index;type:varchar(255)"` //domain project key
26+
ProjectKey string `gorm:"index;type:varchar(500)"` //domain project key
2727
FileName string `gorm:"type:varchar(2000)"`
2828
FilePath string
2929
FileLanguage string `gorm:"type:varchar(20)"`

backend/core/models/domainlayer/codequality/cq_issues.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type CqIssue struct {
2727
Rule string `gorm:"type:varchar(255)"`
2828
Severity string `gorm:"type:varchar(100)"`
2929
Component string
30-
ProjectKey string `gorm:"index;type:varchar(100)"` //domain project key
30+
ProjectKey string `gorm:"index;type:varchar(500)"` //domain project key
3131
Line int
3232
Status string `gorm:"type:varchar(20)"`
3333
Message string
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
Licensed to the Apache Software Foundation (ASF) under one or more
3+
contributor license agreements. See the NOTICE file distributed with
4+
this work for additional information regarding copyright ownership.
5+
The ASF licenses this file to You under the Apache License, Version 2.0
6+
(the "License"); you may not use this file except in compliance with
7+
the License. You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
*/
17+
18+
package migrationscripts
19+
20+
import (
21+
"github.com/apache/incubator-devlake/core/context"
22+
"github.com/apache/incubator-devlake/core/errors"
23+
"github.com/apache/incubator-devlake/core/plugin"
24+
)
25+
26+
var _ plugin.MigrationScript = (*increaseCqIssuesProjectKeyLength)(nil)
27+
28+
type increaseCqIssuesProjectKeyLength struct{}
29+
30+
func (script *increaseCqIssuesProjectKeyLength) Up(basicRes context.BasicRes) errors.Error {
31+
db := basicRes.GetDal()
32+
if err := db.ModifyColumnType("cq_issues", "project_key", "varchar(500)"); err != nil {
33+
return err
34+
}
35+
return db.ModifyColumnType("cq_file_metrics", "project_key", "varchar(500)")
36+
}
37+
38+
func (*increaseCqIssuesProjectKeyLength) Version() uint64 {
39+
return 20260317000000
40+
}
41+
42+
func (*increaseCqIssuesProjectKeyLength) Name() string {
43+
return "increase cq_issues and cq_file_metrics project_key length to 500"
44+
}

backend/core/models/migrationscripts/register.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,5 +143,6 @@ func All() []plugin.MigrationScript {
143143
new(addPipelinePriority),
144144
new(fixNullPriority),
145145
new(modifyCicdDeploymentsToText),
146+
new(increaseCqIssuesProjectKeyLength),
146147
}
147148
}

0 commit comments

Comments
 (0)