Sprint Scope Changes via SQL

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

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')

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

Suggest an answer

Log in or Join to answer
Community showcase
Teodora [Botron]
Published Feb 15, 2018 in Marketplace Apps

Jira Inferno: The Nine Circles of Jira Administration Hell

If you spend enough time as a Jira admin - whether you are managing a single, mid-sized instance, a large enterprise one or juggling multiple instances at once - you will eventually find yourself in ...

1,230 views 6 19
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot