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 7857bd50953b2f6b0ade6f426fddce14ea441b73
Author: Klesh Wong <[email protected]>
AuthorDate: Tue Aug 13 16:04:18 2024 +0800

    fix: change gitee issue components field to text
---
 backend/plugins/gitee/models/issue.go              |  2 +-
 ....go => 20240813_change_issue_component_type.go} | 23 +++++++++++++++-------
 .../gitee/models/migrationscripts/register.go      |  1 +
 3 files changed, 18 insertions(+), 8 deletions(-)

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),
        }
 }

Reply via email to