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 ae6621a2c390d435aa029434eae8f9d03176dfe3
Author: Klesh Wong <[email protected]>
AuthorDate: Tue Aug 13 15:40:32 2024 +0800

    fix: #7852 sonarqube issues component field data too long
---
 ....go => 20240813_change_issue_component_type.go} | 38 ++++++++++++----------
 .../sonarqube/models/migrationscripts/register.go  |  1 +
 .../plugins/sonarqube/models/sonarqube_issue.go    |  2 +-
 3 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/backend/plugins/sonarqube/models/migrationscripts/register.go 
b/backend/plugins/sonarqube/models/migrationscripts/20240813_change_issue_component_type.go
similarity index 55%
copy from backend/plugins/sonarqube/models/migrationscripts/register.go
copy to 
backend/plugins/sonarqube/models/migrationscripts/20240813_change_issue_component_type.go
index 3f2181367..eb7e713c8 100644
--- a/backend/plugins/sonarqube/models/migrationscripts/register.go
+++ 
b/backend/plugins/sonarqube/models/migrationscripts/20240813_change_issue_component_type.go
@@ -17,22 +17,24 @@ limitations under the License.
 
 package migrationscripts
 
-import "github.com/apache/incubator-devlake/core/plugin"
-
-// All return all the migration scripts
-func All() []plugin.MigrationScript {
-       return []plugin.MigrationScript{
-               new(addInitTables),
-               new(modifyCharacterSet),
-               new(expandProjectKey20230206),
-               new(addRawParamTableForScope),
-               new(addScopeConfigIdToProject),
-               new(modifyFileMetricsKeyLength),
-               new(modifyComponentLength),
-               new(addSonarQubeScopeConfig20231214),
-               new(modifyCommitCharacterType),
-               new(modifyCommitCharacterType0508),
-               new(updateSonarQubeScopeConfig20240614),
-               new(modifyNameLength),
-       }
+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_sonarqube_issues", 
"components", "text")
+}
+
+func (*changeIssueComponentType) Version() uint64 {
+       return 20240813153541
+}
+
+func (*changeIssueComponentType) Name() string {
+       return "change _tool_sonarqube_issues.components type to text"
 }
diff --git a/backend/plugins/sonarqube/models/migrationscripts/register.go 
b/backend/plugins/sonarqube/models/migrationscripts/register.go
index 3f2181367..dae45e25c 100644
--- a/backend/plugins/sonarqube/models/migrationscripts/register.go
+++ b/backend/plugins/sonarqube/models/migrationscripts/register.go
@@ -34,5 +34,6 @@ func All() []plugin.MigrationScript {
                new(modifyCommitCharacterType0508),
                new(updateSonarQubeScopeConfig20240614),
                new(modifyNameLength),
+               new(changeIssueComponentType),
        }
 }
diff --git a/backend/plugins/sonarqube/models/sonarqube_issue.go 
b/backend/plugins/sonarqube/models/sonarqube_issue.go
index 3bc8a2b13..fefd75721 100644
--- a/backend/plugins/sonarqube/models/sonarqube_issue.go
+++ b/backend/plugins/sonarqube/models/sonarqube_issue.go
@@ -26,7 +26,7 @@ type SonarqubeIssue struct {
        IssueKey     string `gorm:"primaryKey;type:varchar(100)"`
        Rule         string `gorm:"type:varchar(255)"`
        Severity     string `gorm:"type:varchar(100)"`
-       Component    string `gorm:"type:varchar(500)"`
+       Component    string `gorm:"type:text"`
        ProjectKey   string `gorm:"index;type:varchar(255)"` //domain project 
key
        Line         int
        Status       string `gorm:"type:varchar(20)"`

Reply via email to