Sprint Scope Changes via SQL

Deleted user September 11, 2013

Is there a way to tell via the DB, what issues have been added and removed from a sprint? I'm hoping I can do it for an open sprint but a closed sprint would be better than nothing.

This information is available somewhere it seems as the sprint reports pull the necessary information.

2 answers

1 accepted

2 votes
Answer accepted
Deleted user October 31, 2013

CHANGEITEM and CHANGEGROUP tell you when the customfield value related to the sprint changes and hence what's added/removed based on the time. The SQL below is what I'm using to get the items added and removed while the sprint is in progress.

Hope that helps.

select sprint.name sprint_name,
sprint.start_date / 60 / 60 / 24 / 1000 + to_date('12/31/1969 08:00:00 PM','mm/dd/yyyy hh12:mi:ss AM') start_date,
sprint.complete_date / 60 / 60 / 24 / 1000 + to_date('12/31/1969 08:00:00 PM','mm/dd/yyyy hh12:mi:ss AM') complete_date,
'REMOVED' action, i.pkey issue_key
from changeitem ci, changegroup cg, ao_60DB71_sprint sprint, jiraissue i
where ci.field = 'Sprint' and ci.groupid = cg.id
and instr(replace(','||to_char(ci.oldvalue)||',',' ',''),',' || sprint.id || ',') > 0
and instr(replace(','||to_char(ci.newvalue)||',',' ',''),',' || sprint.id || ',') = 0
and cg.created between
sprint.start_date / 60 / 60 / 24 / 1000 + to_date('12/31/1969 08:00:00 PM','mm/dd/yyyy hh12:mi:ss AM') and
nvl(sprint.complete_date / 60 / 60 / 24 / 1000 + to_date('12/31/1969 08:00:00 PM','mm/dd/yyyy hh12:mi:ss AM'),sysdate + 21)
and sprint.start_date is not null
and cg.issueid = i.id
and not exists (select 1 from issuetype it where i.issuetype = it.id and it.pstyle = 'jira_subtask')
union all
select sprint.name,
sprint.start_date / 60 / 60 / 24 / 1000 + to_date('12/31/1969 08:00:00 PM','mm/dd/yyyy hh12:mi:ss AM') start_date,
sprint.complete_date / 60 / 60 / 24 / 1000 + to_date('12/31/1969 08:00:00 PM','mm/dd/yyyy hh12:mi:ss AM') complete_date,
'ADDED' action, i.pkey issue_key
from changeitem ci, changegroup cg, ao_60DB71_sprint sprint, jiraissue i
where ci.field = 'Sprint' and ci.groupid = cg.id
and instr(replace(','||to_char(ci.oldvalue)||',',' ',''),',' || sprint.id || ',') = 0
and instr(replace(','||to_char(ci.newvalue)||',',' ',''),',' || sprint.id || ',') > 0
and cg.created between
sprint.start_date / 60 / 60 / 24 / 1000 + to_date('12/31/1969 08:00:00 PM','mm/dd/yyyy hh12:mi:ss AM') and
nvl(sprint.complete_date / 60 / 60 / 24 / 1000 + to_date('12/31/1969 08:00:00 PM','mm/dd/yyyy hh12:mi:ss AM'),sysdate + 21)
and sprint.start_date is not null
and cg.issueid = i.id
and not exists (select 1 from issuetype it where i.issuetype = it.id and it.pstyle = 'jira_subtask')

0 votes
Philip Chiappini October 31, 2013

Were you ever able to find an answer to this? I'd like to do the same thing.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events