Skip to content

Commit 27c771a

Browse files
DoDiODevklesh
andauthored
fix(jira): change _tool_jira_issues.fix_versions column to text (apache#8988)
The `fix_versions` field on the jira issue model is declared as `gorm:"type:text"`, but the original migration (20250619_add_fix_versions_to_issue) created the column as `varchar(255)`. Installations that ran the earlier migration therefore have a `varchar(255)` column that no longer matches the model and truncates long fix version lists. This migration alters `_tool_jira_issues.fix_versions` to `text` so the database schema matches the model definition and can store values longer than 255 characters. Signed-off-by: DoDiODev <DoDiDev@proton.me> Co-authored-by: Klesh Wong <klesh@qq.com>
1 parent b4b53b8 commit 27c771a

2 files changed

Lines changed: 47 additions & 0 deletions

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
Licensed to the Apache Software Foundation (ASF) under one or more
3+
contributor license agreements. See the NOTICE file distributed with
4+
this work for additional information regarding copyright ownership.
5+
The ASF licenses this file to You under the Apache License, Version 2.0
6+
(the "License"); you may not use this file except in compliance with
7+
the License. You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
*/
17+
18+
package migrationscripts
19+
20+
import (
21+
"github.com/apache/incubator-devlake/core/context"
22+
"github.com/apache/incubator-devlake/core/errors"
23+
"github.com/apache/incubator-devlake/helpers/migrationhelper"
24+
)
25+
26+
type jiraIssue20260707 struct {
27+
FixVersions string `gorm:"type:text;column:fix_versions"`
28+
}
29+
30+
func (jiraIssue20260707) TableName() string {
31+
return "_tool_jira_issues"
32+
}
33+
34+
type changeFixVersionsToText20260707 struct{}
35+
36+
func (script *changeFixVersionsToText20260707) Up(basicRes context.BasicRes) errors.Error {
37+
return migrationhelper.AutoMigrateTables(basicRes, &jiraIssue20260707{})
38+
}
39+
40+
func (*changeFixVersionsToText20260707) Version() uint64 {
41+
return 20260707140000
42+
}
43+
44+
func (*changeFixVersionsToText20260707) Name() string {
45+
return "change fix_versions type to text in _tool_jira_issues"
46+
}

backend/plugins/jira/models/migrationscripts/register.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ func All() []plugin.MigrationScript {
5656
new(updateScopeConfig),
5757
new(addFixVersions20250619),
5858
new(addSubQueryToBoards),
59+
new(changeFixVersionsToText20260707),
5960
new(addExtraJQLToScopeConfig),
6061
}
6162
}

0 commit comments

Comments
 (0)