-
Notifications
You must be signed in to change notification settings - Fork 542
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: modify _tool_jira_issue_relationships primary key (#6253)
* fix: modify _tool_jira_issue_relationships primary key * fix: ci lint
- Loading branch information
Showing
5 changed files
with
90 additions
and
15 deletions.
There are no files selected for viewing
30 changes: 17 additions & 13 deletions
30
backend/plugins/jira/e2e/snapshot_tables/_tool_jira_issue_relationships.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
connection_id,issue_id,issue_key,type_id,type_name,inward,outward,inward_issue_id,inward_issue_key,outward_issue_id,outward_issue_key | ||
2,10802,DZFNK0168-1,10000,Blocks,is blocked by,blocks,10806,DZFNK0168-5,0, | ||
2,10803,DZFNK0168-2,10000,Blocks,is blocked by,blocks,0,,10823,DZFNK0168-22 | ||
2,10805,DZFNK0168-4,10001,Cloners,is cloned by,clones,0,,10812,DZFNK0168-11 | ||
2,10806,DZFNK0168-5,10002,Duplicate,is duplicated by,duplicates,10812,DZFNK0168-11,0, | ||
2,10812,DZFNK0168-11,10002,Duplicate,is duplicated by,duplicates,116583,IP8CUD168-35305,0, | ||
2,10815,DZFNK0168-14,10002,Duplicate,is duplicated by,duplicates,0,,116566,IP8CUD168-35288 | ||
2,10817,DZFNK0168-16,10001,Cloners,is cloned by,clones,111957,M2VRIQ168-12985,0, | ||
2,10818,DZFNK0168-17,10001,Cloners,is cloned by,clones,0,,111900,M2VRIQ168-12954 | ||
2,10820,DZFNK0168-19,10003,Relates,relates to,relates to,0,,10822,DZFNK0168-21 | ||
2,10821,DZFNK0168-20,10000,Blocks,is blocked by,blocks,116684,IP8CUD168-35406,0, | ||
2,10822,DZFNK0168-21,10003,Relates,relates to,relates to,10820,DZFNK0168-19,0, | ||
2,10823,DZFNK0168-22,10000,Blocks,is blocked by,blocks,10803,DZFNK0168-2,0, | ||
connection_id,issue_id,inward_issue_id,outward_issue_id,issue_key,type_id,type_name,inward,outward,inward_issue_key,outward_issue_key | ||
2,10802,10806,0,DZFNK0168-1,10000,Blocks,is blocked by,blocks,DZFNK0168-5, | ||
2,10803,0,10823,DZFNK0168-2,10000,Blocks,is blocked by,blocks,,DZFNK0168-22 | ||
2,10805,0,10812,DZFNK0168-4,10001,Cloners,is cloned by,clones,,DZFNK0168-11 | ||
2,10806,0,10802,DZFNK0168-5,10000,Blocks,is blocked by,blocks,,DZFNK0168-1 | ||
2,10806,10812,0,DZFNK0168-5,10002,Duplicate,is duplicated by,duplicates,DZFNK0168-11, | ||
2,10812,0,10806,DZFNK0168-11,10002,Duplicate,is duplicated by,duplicates,,DZFNK0168-5 | ||
2,10812,10805,0,DZFNK0168-11,10001,Cloners,is cloned by,clones,DZFNK0168-4, | ||
2,10812,116583,0,DZFNK0168-11,10002,Duplicate,is duplicated by,duplicates,IP8CUD168-35305, | ||
2,10815,0,116566,DZFNK0168-14,10002,Duplicate,is duplicated by,duplicates,,IP8CUD168-35288 | ||
2,10817,111957,0,DZFNK0168-16,10001,Cloners,is cloned by,clones,M2VRIQ168-12985, | ||
2,10818,0,111900,DZFNK0168-17,10001,Cloners,is cloned by,clones,,M2VRIQ168-12954 | ||
2,10820,0,10822,DZFNK0168-19,10003,Relates,relates to,relates to,,DZFNK0168-21 | ||
2,10821,0,116582,DZFNK0168-20,10000,Blocks,is blocked by,blocks,,IP8CUD168-35304 | ||
2,10821,116684,0,DZFNK0168-20,10000,Blocks,is blocked by,blocks,IP8CUD168-35406, | ||
2,10822,10820,0,DZFNK0168-21,10003,Relates,relates to,relates to,DZFNK0168-19, | ||
2,10823,10803,0,DZFNK0168-22,10000,Blocks,is blocked by,blocks,DZFNK0168-2, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
...end/plugins/jira/models/migrationscripts/20231016_modify_issue_relationship_primarykey.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
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/models/migrationscripts/archived" | ||
"github.com/apache/incubator-devlake/helpers/migrationhelper" | ||
jiraArchived "github.com/apache/incubator-devlake/plugins/jira/models/migrationscripts/archived" | ||
) | ||
|
||
type modifyIssueRelationship struct{} | ||
|
||
type JiraIssueRelationship20231016 struct { | ||
archived.NoPKModel | ||
ConnectionId uint64 `gorm:"primaryKey"` | ||
IssueId uint64 `gorm:"primarykey"` | ||
IssueKey string `gorm:"type:varchar(255)"` // e.g. DEV-1 | ||
TypeId uint64 // e.g. 10001 | ||
TypeName string `gorm:"type:varchar(255)"` // e.g. Blocks | ||
Inward string `gorm:"type:varchar(255)"` // e.g. blocks | ||
Outward string `gorm:"type:varchar(255)"` // e.g. is blocked by | ||
InwardIssueId uint64 `gorm:"primaryKey"` // e.g. 116566 | ||
InwardIssueKey string `gorm:"type:varchar(255)"` // e.g. DEV-2 | ||
OutwardIssueId uint64 `gorm:"primaryKey"` // e.g. 116567 | ||
OutwardIssueKey string `gorm:"type:varchar(255)"` // e.g. DEV-3 | ||
} | ||
|
||
func (JiraIssueRelationship20231016) TableName() string { | ||
return "_tool_jira_issue_relationships" | ||
} | ||
|
||
func (script *modifyIssueRelationship) Up(basicRes context.BasicRes) errors.Error { | ||
err := basicRes.GetDal().DropTables(&jiraArchived.JiraIssueRelationship{}) | ||
if err != nil { | ||
return err | ||
} | ||
return migrationhelper.AutoMigrateTables( | ||
basicRes, | ||
&JiraIssueRelationship20231016{}, | ||
) | ||
} | ||
|
||
func (*modifyIssueRelationship) Version() uint64 { | ||
return 20231016122537 | ||
} | ||
|
||
func (*modifyIssueRelationship) Name() string { | ||
return "modify _tool_jira_issue_relationships table primary key" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters