Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: issue add is_subtask field #7879

Merged
merged 6 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion backend/core/models/domainlayer/ticket/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ limitations under the License.
package ticket

import (
"github.com/apache/incubator-devlake/core/models/domainlayer"
"time"

"github.com/apache/incubator-devlake/core/models/domainlayer"
)

type Issue struct {
Expand Down Expand Up @@ -52,6 +53,7 @@ type Issue struct {
Urgency string `gorm:"type:varchar(255)"`
Component string `gorm:"type:varchar(255)"`
OriginalProject string `gorm:"type:varchar(255)"`
IsSubtask bool
}

func (Issue) TableName() string {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
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 = (*addIsSubtaskToIssue)(nil)

type issue20240813 struct {
IsSubtask bool
}

func (issue20240813) TableName() string {
return "issues"
}

type addIsSubtaskToIssue struct{}

func (*addIsSubtaskToIssue) Up(basicRes context.BasicRes) errors.Error {
db := basicRes.GetDal()
if err := db.AutoMigrate(&issue20240813{}); err != nil {
return err
}
return nil
}

func (*addIsSubtaskToIssue) Version() uint64 {
return 20240813142101
}

func (*addIsSubtaskToIssue) Name() string {
return "add is_subtask to issues"
}
1 change: 1 addition & 0 deletions backend/core/models/migrationscripts/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,6 @@ func All() []plugin.MigrationScript {
new(addTableScopeIdToIncident),
new(addDateFieldsToProjectPrMetric),
new(addAssigneeToIncident),
new(addIsSubtaskToIssue),
}
}
1 change: 1 addition & 0 deletions backend/plugins/jira/tasks/issue_convertor.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ func ConvertIssues(subtaskCtx plugin.SubTaskContext) errors.Error {
TimeSpentMinutes: jiraIssue.SpentMinutes,
OriginalProject: jiraIssue.ProjectName,
Component: jiraIssue.Components,
IsSubtask: jiraIssue.Subtask,
}
if jiraIssue.CreatorAccountId != "" {
issue.CreatorId = accountIdGen.Generate(data.Options.ConnectionId, jiraIssue.CreatorAccountId)
Expand Down
6 changes: 3 additions & 3 deletions backend/plugins/opsgenie/e2e/snapshot_tables/issues.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
id,url,icon_url,issue_key,title,description,epic_key,type,original_type,status,original_status,story_point,resolution_date,created_date,updated_date,lead_time_minutes,original_estimate_minutes,time_spent_minutes,time_remaining_minutes,parent_issue_id,priority
opsgenie:Incident:1:3a74524a-f492-4172-b3f5-6041c7cb404a,https://sandesvitor.app.opsgenie.com/incident/detail/3a74524a-f492-4172-b3f5-6041c7cb404a,,3a74524a-f492-4172-b3f5-6041c7cb404a,Incident#1,Test Description,,INCIDENT,,IN_PROGRESS,open,,,2023-09-06T14:30:56.346+00:00,2023-09-06T14:30:57.035+00:00,,,,,,P3
opsgenie:Incident:1:3f84e009-7548-4e7d-832a-fa82c1ceb6b1,https://sandesvitor.app.opsgenie.com/incident/detail/3f84e009-7548-4e7d-832a-fa82c1ceb6b1,,3f84e009-7548-4e7d-832a-fa82c1ceb6b1,Incident#2,Test Description,,INCIDENT,,DONE,resolved,,2023-09-05T18:21:21.490+00:00,2023-09-05T18:20:28.003+00:00,2023-09-05T18:21:21.490+00:00,0,,,,,P5
id,url,icon_url,issue_key,title,description,epic_key,type,original_type,status,original_status,story_point,resolution_date,created_date,updated_date,lead_time_minutes,original_estimate_minutes,time_spent_minutes,time_remaining_minutes,parent_issue_id,priority,urgency,is_subtask
opsgenie:Incident:1:3a74524a-f492-4172-b3f5-6041c7cb404a,https://sandesvitor.app.opsgenie.com/incident/detail/3a74524a-f492-4172-b3f5-6041c7cb404a,,3a74524a-f492-4172-b3f5-6041c7cb404a,Incident#1,Test Description,,INCIDENT,,IN_PROGRESS,open,,,2023-09-06T14:30:56.346+00:00,2023-09-06T14:30:57.035+00:00,,,,,,P3,,0
opsgenie:Incident:1:3f84e009-7548-4e7d-832a-fa82c1ceb6b1,https://sandesvitor.app.opsgenie.com/incident/detail/3f84e009-7548-4e7d-832a-fa82c1ceb6b1,,3f84e009-7548-4e7d-832a-fa82c1ceb6b1,Incident#2,Test Description,,INCIDENT,,DONE,resolved,,2023-09-05T18:21:21.490+00:00,2023-09-05T18:20:28.003+00:00,2023-09-05T18:21:21.490+00:00,0,,,,,P5,,0
8 changes: 4 additions & 4 deletions backend/plugins/pagerduty/e2e/snapshot_tables/issues.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
id,url,icon_url,issue_key,title,description,epic_key,type,original_type,status,original_status,story_point,resolution_date,created_date,updated_date,lead_time_minutes,original_estimate_minutes,time_spent_minutes,time_remaining_minutes,creator_id,creator_name,assignee_id,assignee_name,parent_issue_id,priority,severity,urgency,component
pagerduty:Incident:1:4,https://keon-test.pagerduty.com/incidents/Q3YON8WNWTZMRQ,,4,,[#4] Crash reported,,INCIDENT,,TODO,triggered,,,2022-11-03T06:23:06.000+00:00,2022-11-03T07:02:36.000+00:00,,,,,,,P25K520,Kian Amini,,,,high,
pagerduty:Incident:1:5,https://keon-test.pagerduty.com/incidents/Q3CZAU7Q4008QD,,5,,[#5] Slow startup,,INCIDENT,,IN_PROGRESS,acknowledged,,,2022-11-03T06:44:28.000+00:00,2022-11-03T06:44:37.000+00:00,,,,,,,PQYACO3,Keon Amini,,,,high,
pagerduty:Incident:1:6,https://keon-test.pagerduty.com/incidents/Q1OHFWFP3GPXOG,,6,,[#6] Spamming logs,,INCIDENT,,DONE,resolved,,2022-11-03T06:51:44.000+00:00,2022-11-03T06:45:36.000+00:00,2022-11-03T06:51:44.000+00:00,6,,,,,,,,,,,low,
id,url,icon_url,issue_key,title,description,epic_key,type,original_type,status,original_status,story_point,resolution_date,created_date,updated_date,lead_time_minutes,original_estimate_minutes,time_spent_minutes,time_remaining_minutes,creator_id,creator_name,assignee_id,assignee_name,parent_issue_id,priority,severity,urgency,component,is_subtask
pagerduty:Incident:1:4,https://keon-test.pagerduty.com/incidents/Q3YON8WNWTZMRQ,,4,,[#4] Crash reported,,INCIDENT,,TODO,triggered,,,2022-11-03T06:23:06.000+00:00,2022-11-03T07:02:36.000+00:00,,,,,,,P25K520,Kian Amini,,,,high,,0
pagerduty:Incident:1:5,https://keon-test.pagerduty.com/incidents/Q3CZAU7Q4008QD,,5,,[#5] Slow startup,,INCIDENT,,IN_PROGRESS,acknowledged,,,2022-11-03T06:44:28.000+00:00,2022-11-03T06:44:37.000+00:00,,,,,,,PQYACO3,Keon Amini,,,,high,,0
pagerduty:Incident:1:6,https://keon-test.pagerduty.com/incidents/Q1OHFWFP3GPXOG,,6,,[#6] Spamming logs,,INCIDENT,,DONE,resolved,,2022-11-03T06:51:44.000+00:00,2022-11-03T06:45:36.000+00:00,2022-11-03T06:51:44.000+00:00,6,,,,,,,,,,,low,,0
Loading
Loading