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

    fix: change github issue components field to text
---
 backend/plugins/github/models/issue.go             |  2 +-
 .../20240813_change_issue_component_type.go        | 40 ++++++++++++++++++++++
 .../github/models/migrationscripts/register.go     |  1 +
 3 files changed, 42 insertions(+), 1 deletion(-)

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/github/models/migrationscripts/20240813_change_issue_component_type.go
 
b/backend/plugins/github/models/migrationscripts/20240813_change_issue_component_type.go
new file mode 100644
index 000000000..be5a3be12
--- /dev/null
+++ 
b/backend/plugins/github/models/migrationscripts/20240813_change_issue_component_type.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 = (*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),
        }
 }

Reply via email to