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 7a300ef44ec67f684b3353f21e5e21445f0c5fba Author: Klesh Wong <[email protected]> AuthorDate: Tue Aug 13 16:04:00 2024 +0800 fix: change bitbucket issue components field to text --- backend/plugins/bitbucket/models/issue.go | 2 +- ....go => 20240813_change_issue_component_type.go} | 39 ++++++++++------------ .../bitbucket/models/migrationscripts/register.go | 1 + 3 files changed, 19 insertions(+), 23 deletions(-) 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/bitbucket/models/migrationscripts/register.go b/backend/plugins/bitbucket/models/migrationscripts/20240813_change_issue_component_type.go similarity index 52% copy from backend/plugins/bitbucket/models/migrationscripts/register.go copy to backend/plugins/bitbucket/models/migrationscripts/20240813_change_issue_component_type.go index a197be735..0499d0ac2 100644 --- a/backend/plugins/bitbucket/models/migrationscripts/register.go +++ b/backend/plugins/bitbucket/models/migrationscripts/20240813_change_issue_component_type.go @@ -18,28 +18,23 @@ limitations under the License. package migrationscripts import ( - plugin "github.com/apache/incubator-devlake/core/plugin" + "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(addInitTables20220803), - new(addPipeline20220914), - new(addPrCommits20221008), - new(addDeployment20221013), - new(addRepoIdAndCommitShaField20221014), - new(addScope20230206), - new(addPipelineStep20230215), - new(addConnectionIdToTransformationRule), - new(addTypeEnvToPipelineAndStep), - new(addRepoIdField20230411), - new(addRepoIdToPr), - new(addBitbucketCommitAuthorInfo), - new(renameTr2ScopeConfig), - new(addRawParamTableForScope), - new(addBuildNumberToPipelines), - new(reCreatBitBucketPipelineSteps), - new(addMergedByToPr), - } +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), } }
