You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ly...@apache.org on 2024/08/14 12:23:10 UTC

(incubator-devlake) branch main updated: Fix a couple of "Data too long" errors from sonarqube, jira, etc (#7885)

This is an automated email from the ASF dual-hosted git repository.

lynwee pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new 7e97e431a Fix a couple of "Data too long" errors from sonarqube, jira, etc (#7885)
7e97e431a is described below

commit 7e97e431a33f7f239ae1024aa73a2995d73d77d7
Author: Klesh Wong <zh...@merico.dev>
AuthorDate: Wed Aug 14 20:23:05 2024 +0800

    Fix a couple of "Data too long" errors from sonarqube, jira, etc (#7885)
    
    * refactor: remove extraction logic from github graphql collector
    
    * fix: pull requests not being updated
    
    * refactor: update github job extractor for single record structure
    
    * refactor: update github issue extractor to extract single record
    
    * refactor: update github deployment extractor to extract single records
    
    * refactor: update github account/release extractor to adopt single record extraction
    
    * docs: add comments
    
    * fix: github issues not being updated
    
    * fix: gitub deployment unit test
    
    * fix: change jira issue component field to text type
    
    * fix: column type should not be parameterized
    
    * fix: #7852 sonarqube issues component field data too long
    
    * fix: change issue.components to text to avoid data too long error
    
    * docs: fix jira issues component tag
    
    * fix: change bitbucket issue components field to text
    
    * fix: change gitee issue components field to text
    
    * fix: change github issue components field to text
    
    * fix: change gitlab issue components field to text
    
    * fix: #7715 Data too long for column 'project_key'
    
    * fix(framework): update trigger api's request body schema (#7888)
    
    * fix(framework): update trigger api's request body schema
    
    * fix(framework): fix test errors
    
    * fix(framework): fix test errors
    
    * test(jira): add e2e test for custom account field in issues (#7894)
    
    * fix: github graphql collectors are not refetching data in incremental mode (#7878)
    
    * refactor: remove extraction logic from github graphql collector
    
    * fix: pull requests not being updated
    
    * refactor: update github job extractor for single record structure
    
    * refactor: update github issue extractor to extract single record
    
    * refactor: update github deployment extractor to extract single records
    
    * refactor: update github account/release extractor to adopt single record extraction
    
    * docs: add comments
    
    * fix: github issues not being updated
    
    * fix: gitub deployment unit test
    
    * fix: github graphql issue collector should order records by CREATED_AT to avoid data missing
    
    * fix: linting
    
    ---------
    
    Co-authored-by: Lynwee <15...@qq.com>
---
 backend/core/dal/dal.go                            |  2 ++
 .../models/domainlayer/codequality/cq_projects.go  |  2 +-
 backend/core/models/domainlayer/ticket/issue.go    |  2 +-
 .../20240813_change_issue_component_type.go}       | 23 +++++++++++++++-------
 .../20240813_increase_project_key_length.go}       | 23 +++++++++++++++-------
 backend/impls/dalgorm/dalgorm.go                   | 18 +++++++++++++++++
 backend/plugins/bitbucket/models/issue.go          |  2 +-
 .../20240813_change_issue_component_type.go}       | 23 +++++++++++++++-------
 .../bitbucket/models/migrationscripts/register.go  |  1 +
 backend/plugins/gitee/models/issue.go              |  2 +-
 ....go => 20240813_change_issue_component_type.go} | 23 +++++++++++++++-------
 .../gitee/models/migrationscripts/register.go      |  1 +
 backend/plugins/github/models/issue.go             |  2 +-
 .../20240813_change_issue_component_type.go}       | 23 +++++++++++++++-------
 .../github/models/migrationscripts/register.go     |  1 +
 backend/plugins/gitlab/models/issue.go             |  2 +-
 .../20240813_change_issue_component_type.go}       | 23 +++++++++++++++-------
 .../gitlab/models/migrationscripts/register.go     |  1 +
 backend/plugins/jira/models/issue.go               |  2 +-
 .../20240809_change_issue_component_type.go}       | 23 +++++++++++++++-------
 .../jira/models/migrationscripts/register.go       |  1 +
 backend/plugins/sonarqube/api/blueprint_v200.go    |  2 +-
 .../20240813_change_issue_component_type.go}       | 23 +++++++++++++++-------
 .../20240813_increase_project_key_length.go}       | 23 +++++++++++++++-------
 .../sonarqube/models/migrationscripts/register.go  |  2 ++
 .../plugins/sonarqube/models/sonarqube_issue.go    |  2 +-
 .../plugins/sonarqube/models/sonarqube_project.go  |  2 +-
 .../plugins/sonarqube/tasks/projects_convertor.go  | 12 +++++------
 28 files changed, 187 insertions(+), 79 deletions(-)

diff --git a/backend/core/dal/dal.go b/backend/core/dal/dal.go
index 48cc36010..d5f4fbfea 100644
--- a/backend/core/dal/dal.go
+++ b/backend/core/dal/dal.go
@@ -167,6 +167,8 @@ type Dal interface {
 	GetPrimaryKeyFields(t reflect.Type) []reflect.StructField
 	// RenameColumn renames column name for specified table
 	RenameColumn(table, oldColumnName, newColumnName string) errors.Error
+	// ModifyColumnType modifies column type
+	ModifyColumnType(table, columnName, columnType string) errors.Error
 	// DropIndexes drops all specified tables
 	DropIndexes(table string, indexes ...string) errors.Error
 	// Dialect returns the dialect of current database
diff --git a/backend/core/models/domainlayer/codequality/cq_projects.go b/backend/core/models/domainlayer/codequality/cq_projects.go
index 5ba5d11b2..fe80dd1bb 100644
--- a/backend/core/models/domainlayer/codequality/cq_projects.go
+++ b/backend/core/models/domainlayer/codequality/cq_projects.go
@@ -26,7 +26,7 @@ import (
 var _ plugin.Scope = (*CqProject)(nil)
 
 type CqProject struct {
-	domainlayer.DomainEntity
+	domainlayer.DomainEntityExtended
 	Name             string `gorm:"type:varchar(255)"`
 	Qualifier        string `gorm:"type:varchar(255)"`
 	Visibility       string `gorm:"type:varchar(64)"`
diff --git a/backend/core/models/domainlayer/ticket/issue.go b/backend/core/models/domainlayer/ticket/issue.go
index 278b2f825..f7d5cc562 100644
--- a/backend/core/models/domainlayer/ticket/issue.go
+++ b/backend/core/models/domainlayer/ticket/issue.go
@@ -51,7 +51,7 @@ type Issue struct {
 	Priority                string `gorm:"type:varchar(255)"`
 	Severity                string `gorm:"type:varchar(255)"`
 	Urgency                 string `gorm:"type:varchar(255)"`
-	Component               string `gorm:"type:varchar(255)"`
+	Component               string `gorm:"type:text"`
 	OriginalProject         string `gorm:"type:varchar(255)"`
 	IsSubtask               bool
 }
diff --git a/backend/plugins/gitee/models/migrationscripts/register.go b/backend/core/models/migrationscripts/20240813_change_issue_component_type.go
similarity index 60%
copy from backend/plugins/gitee/models/migrationscripts/register.go
copy to backend/core/models/migrationscripts/20240813_change_issue_component_type.go
index 5e5ec1388..8f7a2f2fe 100644
--- a/backend/plugins/gitee/models/migrationscripts/register.go
+++ b/backend/core/models/migrationscripts/20240813_change_issue_component_type.go
@@ -18,14 +18,23 @@ 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"
 )
 
-// All return all the migration scripts
-func All() []plugin.MigrationScript {
-	return []plugin.MigrationScript{
-		new(addInitTables),
-		new(addGiteeCommitAuthorInfo),
-		new(addScopeConfigIdToRepo),
-	}
+var _ plugin.MigrationScript = (*changeIssueComponentType)(nil)
+
+type changeIssueComponentType struct{}
+
+func (script *changeIssueComponentType) Up(basicRes context.BasicRes) errors.Error {
+	return basicRes.GetDal().ModifyColumnType("issues", "components", "text")
+}
+
+func (*changeIssueComponentType) Version() uint64 {
+	return 20240813153901
+}
+
+func (*changeIssueComponentType) Name() string {
+	return "change issues.components type to text"
 }
diff --git a/backend/plugins/gitee/models/migrationscripts/register.go b/backend/core/models/migrationscripts/20240813_increase_project_key_length.go
similarity index 59%
copy from backend/plugins/gitee/models/migrationscripts/register.go
copy to backend/core/models/migrationscripts/20240813_increase_project_key_length.go
index 5e5ec1388..609b3d736 100644
--- a/backend/plugins/gitee/models/migrationscripts/register.go
+++ b/backend/core/models/migrationscripts/20240813_increase_project_key_length.go
@@ -18,14 +18,23 @@ 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"
 )
 
-// All return all the migration scripts
-func All() []plugin.MigrationScript {
-	return []plugin.MigrationScript{
-		new(addInitTables),
-		new(addGiteeCommitAuthorInfo),
-		new(addScopeConfigIdToRepo),
-	}
+var _ plugin.MigrationScript = (*increaseProjectKeyLength)(nil)
+
+type increaseProjectKeyLength struct{}
+
+func (script *increaseProjectKeyLength) Up(basicRes context.BasicRes) errors.Error {
+	return basicRes.GetDal().ModifyColumnType("cq_projects", "project_key", "varchar(500)")
+}
+
+func (*increaseProjectKeyLength) Version() uint64 {
+	return 20240813160242
+}
+
+func (*increaseProjectKeyLength) Name() string {
+	return "increase cq_projects.project_key length to 500"
 }
diff --git a/backend/impls/dalgorm/dalgorm.go b/backend/impls/dalgorm/dalgorm.go
index ba3bcdb61..59e6b115f 100644
--- a/backend/impls/dalgorm/dalgorm.go
+++ b/backend/impls/dalgorm/dalgorm.go
@@ -372,6 +372,24 @@ func (d *Dalgorm) RenameColumn(table, oldColumnName, newColumnName string) error
 	)
 }
 
+// ModifyColumnType modify column type
+func (d *Dalgorm) ModifyColumnType(table, columnName, columnType string) errors.Error {
+	// work around the error `cached plan must not change result type` for postgres
+	// wrap in func(){} to make the linter happy
+	defer func() {
+		_ = d.Exec("SELECT * FROM ? LIMIT 1", clause.Table{Name: table})
+	}()
+	query := "ALTER TABLE ? MODIFY COLUMN ? %s"
+	if d.db.Dialector.Name() == "postgres" {
+		query = "ALTER TABLE ? ALTER COLUMN ? TYPE %s"
+	}
+	return d.Exec(
+		fmt.Sprintf(query, columnType),
+		clause.Table{Name: table},
+		clause.Column{Name: columnName},
+	)
+}
+
 // AllTables returns all tables in the database
 func (d *Dalgorm) AllTables() ([]string, errors.Error) {
 	var tableSql string
diff --git a/backend/plugins/bitbucket/models/issue.go b/backend/plugins/bitbucket/models/issue.go
index c4f0d20fb..c24fbf1e8 100644
--- a/backend/plugins/bitbucket/models/issue.go
+++ b/backend/plugins/bitbucket/models/issue.go
@@ -45,7 +45,7 @@ type BitbucketIssue struct {
 	BitbucketCreatedAt time.Time
 	BitbucketUpdatedAt time.Time `gorm:"index"`
 	Severity           string    `gorm:"type:varchar(255)"`
-	Component          string    `gorm:"type:varchar(255)"`
+	Component          string    `gorm:"type:text"`
 	common.NoPKModel
 }
 
diff --git a/backend/plugins/gitee/models/migrationscripts/register.go b/backend/plugins/bitbucket/models/migrationscripts/20240813_change_issue_component_type.go
similarity index 59%
copy from backend/plugins/gitee/models/migrationscripts/register.go
copy to backend/plugins/bitbucket/models/migrationscripts/20240813_change_issue_component_type.go
index 5e5ec1388..0499d0ac2 100644
--- a/backend/plugins/gitee/models/migrationscripts/register.go
+++ b/backend/plugins/bitbucket/models/migrationscripts/20240813_change_issue_component_type.go
@@ -18,14 +18,23 @@ 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"
 )
 
-// All return all the migration scripts
-func All() []plugin.MigrationScript {
-	return []plugin.MigrationScript{
-		new(addInitTables),
-		new(addGiteeCommitAuthorInfo),
-		new(addScopeConfigIdToRepo),
-	}
+var _ plugin.MigrationScript = (*changeIssueComponentType)(nil)
+
+type changeIssueComponentType struct{}
+
+func (script *changeIssueComponentType) Up(basicRes context.BasicRes) errors.Error {
+	return basicRes.GetDal().ModifyColumnType("_tool_bitbucket_issues", "components", "text")
+}
+
+func (*changeIssueComponentType) Version() uint64 {
+	return 20240813154323
+}
+
+func (*changeIssueComponentType) Name() string {
+	return "change _tool_bitbucket_issues.components type to text"
 }
diff --git a/backend/plugins/bitbucket/models/migrationscripts/register.go b/backend/plugins/bitbucket/models/migrationscripts/register.go
index a197be735..105af2364 100644
--- a/backend/plugins/bitbucket/models/migrationscripts/register.go
+++ b/backend/plugins/bitbucket/models/migrationscripts/register.go
@@ -41,5 +41,6 @@ func All() []plugin.MigrationScript {
 		new(addBuildNumberToPipelines),
 		new(reCreatBitBucketPipelineSteps),
 		new(addMergedByToPr),
+		new(changeIssueComponentType),
 	}
 }
diff --git a/backend/plugins/gitee/models/issue.go b/backend/plugins/gitee/models/issue.go
index 0753f46f1..60211dcf9 100644
--- a/backend/plugins/gitee/models/issue.go
+++ b/backend/plugins/gitee/models/issue.go
@@ -44,7 +44,7 @@ type GiteeIssue struct {
 	GiteeCreatedAt  time.Time
 	GiteeUpdatedAt  time.Time `gorm:"index"`
 	Severity        string    `gorm:"type:varchar(255)"`
-	Component       string    `gorm:"type:varchar(255)"`
+	Component       string    `gorm:"type:text"`
 	common.NoPKModel
 }
 
diff --git a/backend/plugins/gitee/models/migrationscripts/register.go b/backend/plugins/gitee/models/migrationscripts/20240813_change_issue_component_type.go
similarity index 59%
copy from backend/plugins/gitee/models/migrationscripts/register.go
copy to backend/plugins/gitee/models/migrationscripts/20240813_change_issue_component_type.go
index 5e5ec1388..a669a31dd 100644
--- a/backend/plugins/gitee/models/migrationscripts/register.go
+++ b/backend/plugins/gitee/models/migrationscripts/20240813_change_issue_component_type.go
@@ -18,14 +18,23 @@ 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"
 )
 
-// All return all the migration scripts
-func All() []plugin.MigrationScript {
-	return []plugin.MigrationScript{
-		new(addInitTables),
-		new(addGiteeCommitAuthorInfo),
-		new(addScopeConfigIdToRepo),
-	}
+var _ plugin.MigrationScript = (*changeIssueComponentType)(nil)
+
+type changeIssueComponentType struct{}
+
+func (script *changeIssueComponentType) Up(basicRes context.BasicRes) errors.Error {
+	return basicRes.GetDal().ModifyColumnType("_tool_gitee_issues", "components", "text")
+}
+
+func (*changeIssueComponentType) Version() uint64 {
+	return 20240813154445
+}
+
+func (*changeIssueComponentType) Name() string {
+	return "change _tool_gitee_issues.components type to text"
 }
diff --git a/backend/plugins/gitee/models/migrationscripts/register.go b/backend/plugins/gitee/models/migrationscripts/register.go
index 5e5ec1388..e089a9bec 100644
--- a/backend/plugins/gitee/models/migrationscripts/register.go
+++ b/backend/plugins/gitee/models/migrationscripts/register.go
@@ -27,5 +27,6 @@ func All() []plugin.MigrationScript {
 		new(addInitTables),
 		new(addGiteeCommitAuthorInfo),
 		new(addScopeConfigIdToRepo),
+		new(changeIssueComponentType),
 	}
 }
diff --git a/backend/plugins/github/models/issue.go b/backend/plugins/github/models/issue.go
index 80e071cc5..004e89a28 100644
--- a/backend/plugins/github/models/issue.go
+++ b/backend/plugins/github/models/issue.go
@@ -45,7 +45,7 @@ type GithubIssue struct {
 	GithubCreatedAt time.Time
 	GithubUpdatedAt time.Time `gorm:"index"`
 	Severity        string    `gorm:"type:varchar(255)"`
-	Component       string    `gorm:"type:varchar(255)"`
+	Component       string    `gorm:"type:text"`
 	common.NoPKModel
 }
 
diff --git a/backend/plugins/gitee/models/migrationscripts/register.go b/backend/plugins/github/models/migrationscripts/20240813_change_issue_component_type.go
similarity index 59%
copy from backend/plugins/gitee/models/migrationscripts/register.go
copy to backend/plugins/github/models/migrationscripts/20240813_change_issue_component_type.go
index 5e5ec1388..be5a3be12 100644
--- a/backend/plugins/gitee/models/migrationscripts/register.go
+++ b/backend/plugins/github/models/migrationscripts/20240813_change_issue_component_type.go
@@ -18,14 +18,23 @@ 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"
 )
 
-// All return all the migration scripts
-func All() []plugin.MigrationScript {
-	return []plugin.MigrationScript{
-		new(addInitTables),
-		new(addGiteeCommitAuthorInfo),
-		new(addScopeConfigIdToRepo),
-	}
+var _ plugin.MigrationScript = (*changeIssueComponentType)(nil)
+
+type changeIssueComponentType struct{}
+
+func (script *changeIssueComponentType) Up(basicRes context.BasicRes) errors.Error {
+	return basicRes.GetDal().ModifyColumnType("_tool_github_issues", "components", "text")
+}
+
+func (*changeIssueComponentType) Version() uint64 {
+	return 20240813154633
+}
+
+func (*changeIssueComponentType) Name() string {
+	return "change _tool_github_issues.components type to text"
 }
diff --git a/backend/plugins/github/models/migrationscripts/register.go b/backend/plugins/github/models/migrationscripts/register.go
index fec8b5338..346654d99 100644
--- a/backend/plugins/github/models/migrationscripts/register.go
+++ b/backend/plugins/github/models/migrationscripts/register.go
@@ -53,5 +53,6 @@ func All() []plugin.MigrationScript {
 		new(addMergedByToPr),
 		new(restructReviewer),
 		new(addIsDraftToPr),
+		new(changeIssueComponentType),
 	}
 }
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/gitee/models/migrationscripts/register.go b/backend/plugins/gitlab/models/migrationscripts/20240813_change_issue_component_type.go
similarity index 59%
copy from backend/plugins/gitee/models/migrationscripts/register.go
copy to backend/plugins/gitlab/models/migrationscripts/20240813_change_issue_component_type.go
index 5e5ec1388..08c88ac29 100644
--- a/backend/plugins/gitee/models/migrationscripts/register.go
+++ b/backend/plugins/gitlab/models/migrationscripts/20240813_change_issue_component_type.go
@@ -18,14 +18,23 @@ 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"
 )
 
-// All return all the migration scripts
-func All() []plugin.MigrationScript {
-	return []plugin.MigrationScript{
-		new(addInitTables),
-		new(addGiteeCommitAuthorInfo),
-		new(addScopeConfigIdToRepo),
-	}
+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),
 	}
 }
diff --git a/backend/plugins/jira/models/issue.go b/backend/plugins/jira/models/issue.go
index 0b6294490..12db2b00b 100644
--- a/backend/plugins/jira/models/issue.go
+++ b/backend/plugins/jira/models/issue.go
@@ -62,7 +62,7 @@ type JiraIssue struct {
 	LeadTimeMinutes          *uint
 	StdType                  string `gorm:"type:varchar(255)"`
 	StdStatus                string `gorm:"type:varchar(255)"`
-	Components               string `gorm:"type:varchar(255)"`
+	Components               string `gorm:"type:text"`
 	Subtask                  bool
 	ChangelogTotal           int
 	WorklogTotal             int
diff --git a/backend/plugins/gitee/models/migrationscripts/register.go b/backend/plugins/jira/models/migrationscripts/20240809_change_issue_component_type.go
similarity index 60%
copy from backend/plugins/gitee/models/migrationscripts/register.go
copy to backend/plugins/jira/models/migrationscripts/20240809_change_issue_component_type.go
index 5e5ec1388..30329085c 100644
--- a/backend/plugins/gitee/models/migrationscripts/register.go
+++ b/backend/plugins/jira/models/migrationscripts/20240809_change_issue_component_type.go
@@ -18,14 +18,23 @@ 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"
 )
 
-// All return all the migration scripts
-func All() []plugin.MigrationScript {
-	return []plugin.MigrationScript{
-		new(addInitTables),
-		new(addGiteeCommitAuthorInfo),
-		new(addScopeConfigIdToRepo),
-	}
+var _ plugin.MigrationScript = (*changeIssueComponentType)(nil)
+
+type changeIssueComponentType struct{}
+
+func (script *changeIssueComponentType) Up(basicRes context.BasicRes) errors.Error {
+	return basicRes.GetDal().ModifyColumnType("_tool_jira_issues", "components", "text")
+}
+
+func (*changeIssueComponentType) Version() uint64 {
+	return 20240809165545
+}
+
+func (*changeIssueComponentType) Name() string {
+	return "change jira_issue.components type to text"
 }
diff --git a/backend/plugins/jira/models/migrationscripts/register.go b/backend/plugins/jira/models/migrationscripts/register.go
index f2764ef42..6b7b89f84 100644
--- a/backend/plugins/jira/models/migrationscripts/register.go
+++ b/backend/plugins/jira/models/migrationscripts/register.go
@@ -51,5 +51,6 @@ func All() []plugin.MigrationScript {
 		new(addSubtaskToIssue),
 		new(addTmpAccountIdToJiraIssueChangelogItem),
 		new(addIssueFieldTable),
+		new(changeIssueComponentType),
 	}
 }
diff --git a/backend/plugins/sonarqube/api/blueprint_v200.go b/backend/plugins/sonarqube/api/blueprint_v200.go
index 250b1bf1d..e4804534b 100644
--- a/backend/plugins/sonarqube/api/blueprint_v200.go
+++ b/backend/plugins/sonarqube/api/blueprint_v200.go
@@ -111,7 +111,7 @@ func makeScopesV200(
 		sonarqubeProject := scopeDetail.Scope
 		// add board to scopes
 		domainBoard := &codequality.CqProject{
-			DomainEntity: domainlayer.DomainEntity{
+			DomainEntityExtended: domainlayer.DomainEntityExtended{
 				Id: didgen.NewDomainIdGenerator(&models.SonarqubeProject{}).Generate(sonarqubeProject.ConnectionId, sonarqubeProject.ProjectKey),
 			},
 			Name: sonarqubeProject.Name,
diff --git a/backend/plugins/gitee/models/migrationscripts/register.go b/backend/plugins/sonarqube/models/migrationscripts/20240813_change_issue_component_type.go
similarity index 59%
copy from backend/plugins/gitee/models/migrationscripts/register.go
copy to backend/plugins/sonarqube/models/migrationscripts/20240813_change_issue_component_type.go
index 5e5ec1388..eb7e713c8 100644
--- a/backend/plugins/gitee/models/migrationscripts/register.go
+++ b/backend/plugins/sonarqube/models/migrationscripts/20240813_change_issue_component_type.go
@@ -18,14 +18,23 @@ 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"
 )
 
-// All return all the migration scripts
-func All() []plugin.MigrationScript {
-	return []plugin.MigrationScript{
-		new(addInitTables),
-		new(addGiteeCommitAuthorInfo),
-		new(addScopeConfigIdToRepo),
-	}
+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/gitee/models/migrationscripts/register.go b/backend/plugins/sonarqube/models/migrationscripts/20240813_increase_project_key_length.go
similarity index 58%
copy from backend/plugins/gitee/models/migrationscripts/register.go
copy to backend/plugins/sonarqube/models/migrationscripts/20240813_increase_project_key_length.go
index 5e5ec1388..ed1981670 100644
--- a/backend/plugins/gitee/models/migrationscripts/register.go
+++ b/backend/plugins/sonarqube/models/migrationscripts/20240813_increase_project_key_length.go
@@ -18,14 +18,23 @@ 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"
 )
 
-// All return all the migration scripts
-func All() []plugin.MigrationScript {
-	return []plugin.MigrationScript{
-		new(addInitTables),
-		new(addGiteeCommitAuthorInfo),
-		new(addScopeConfigIdToRepo),
-	}
+var _ plugin.MigrationScript = (*increaseProjectKeyLength)(nil)
+
+type increaseProjectKeyLength struct{}
+
+func (script *increaseProjectKeyLength) Up(basicRes context.BasicRes) errors.Error {
+	return basicRes.GetDal().ModifyColumnType("_tool_sonarqube_projects", "project_key", "varchar(500)")
+}
+
+func (*increaseProjectKeyLength) Version() uint64 {
+	return 20240813155602
+}
+
+func (*increaseProjectKeyLength) Name() string {
+	return "increase _tool_sonarqube_projects.project_key length to 500"
 }
diff --git a/backend/plugins/sonarqube/models/migrationscripts/register.go b/backend/plugins/sonarqube/models/migrationscripts/register.go
index 3f2181367..b11549cb8 100644
--- a/backend/plugins/sonarqube/models/migrationscripts/register.go
+++ b/backend/plugins/sonarqube/models/migrationscripts/register.go
@@ -34,5 +34,7 @@ func All() []plugin.MigrationScript {
 		new(modifyCommitCharacterType0508),
 		new(updateSonarQubeScopeConfig20240614),
 		new(modifyNameLength),
+		new(changeIssueComponentType),
+		new(increaseProjectKeyLength),
 	}
 }
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)"`
diff --git a/backend/plugins/sonarqube/models/sonarqube_project.go b/backend/plugins/sonarqube/models/sonarqube_project.go
index b31e0214f..aeb57134b 100644
--- a/backend/plugins/sonarqube/models/sonarqube_project.go
+++ b/backend/plugins/sonarqube/models/sonarqube_project.go
@@ -26,7 +26,7 @@ var _ plugin.ToolLayerScope = (*SonarqubeProject)(nil)
 
 type SonarqubeProject struct {
 	common.Scope     `mapstructure:",squash"`
-	ProjectKey       string              `json:"projectKey" validate:"required" gorm:"type:varchar(255);primaryKey" mapstructure:"projectKey"`
+	ProjectKey       string              `json:"projectKey" validate:"required" gorm:"type:varchar(500);primaryKey" mapstructure:"projectKey"`
 	Name             string              `json:"name" gorm:"type:varchar(500)" mapstructure:"name"`
 	Qualifier        string              `json:"qualifier" gorm:"type:varchar(255)" mapstructure:"qualifier"`
 	Visibility       string              `json:"visibility" gorm:"type:varchar(64)" mapstructure:"visibility"`
diff --git a/backend/plugins/sonarqube/tasks/projects_convertor.go b/backend/plugins/sonarqube/tasks/projects_convertor.go
index afa6a694d..3e3c1ebba 100644
--- a/backend/plugins/sonarqube/tasks/projects_convertor.go
+++ b/backend/plugins/sonarqube/tasks/projects_convertor.go
@@ -58,12 +58,12 @@ func ConvertProjects(taskCtx plugin.SubTaskContext) errors.Error {
 		Convert: func(inputRow interface{}) ([]interface{}, errors.Error) {
 			sonarqubeProject := inputRow.(*sonarqubeModels.SonarqubeProject)
 			domainProject := &codequality.CqProject{
-				DomainEntity:     domainlayer.DomainEntity{Id: projectIdGen.Generate(data.Options.ConnectionId, sonarqubeProject.ProjectKey)},
-				Name:             sonarqubeProject.Name,
-				Qualifier:        sonarqubeProject.Qualifier,
-				Visibility:       sonarqubeProject.Visibility,
-				LastAnalysisDate: sonarqubeProject.LastAnalysisDate,
-				CommitSha:        sonarqubeProject.Revision,
+				DomainEntityExtended: domainlayer.DomainEntityExtended{Id: projectIdGen.Generate(data.Options.ConnectionId, sonarqubeProject.ProjectKey)},
+				Name:                 sonarqubeProject.Name,
+				Qualifier:            sonarqubeProject.Qualifier,
+				Visibility:           sonarqubeProject.Visibility,
+				LastAnalysisDate:     sonarqubeProject.LastAnalysisDate,
+				CommitSha:            sonarqubeProject.Revision,
 			}
 			return []interface{}{
 				domainProject,