Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,254,235
Community Members
 
Community Events
164
Community Groups

SQL How can I find who opened a Sprint?

Edited

Can somebody help me to find the relation in the database on who opened a particular Sprint?

Thank you!

4 answers

1 accepted

Jira Version: 7.7.1

The data of the sprint creation is stored in the table userhistoryitem, but it is not 100% reliable, as it can be overwritten or be deleted.

userhistoryitem only contains the sprint name at creation time, but not the current sprint name, and the timestamp can be overwritten as stated above.
Usually you will rename the sprint right after creation, so you want to select on the current sprint name.

Here is the database SQL for an oracle database:

select (TO_DATE('1970-01-01','YYYY-MM-DD') + lastviewed / 86400000) changed_timestamp, 
uh.username created_by,
uh.data original_name,
s.name current_sprint_name
from ao_60db71_sprint s
left join userhistoryitem uh
on (uh.entitytype='Sprint' and s.id = uh.entityid)
where s.name like 'MYCURRENTSPRINTNAME'
order by changed_timestamp;

 

Notes

  • replace MYCURRENTSPRINTNAME with your sprint name
  • lastviewed is stored as milliseconds after 01.01.1970, so it needs to be transformed to into a readable format.
  • userhistorydata is tricky. It only stores one record per user and sprint. As long as the creator is the only person editing the sprint name, the changed_timestamp will remain the creation date.
    If, however, a different user (user X) edits the Sprint Name and the creator edits the sprint name again, then the changed_timestamp of the creator will not be the creation date anymore. (it will be the timestamp where he edited the name after user X had edited the name before)
  • userhistorydata gets purged periodically, so this query will only work for a few weeks after sprint creation
  • summary: the first record of the SQL will most probably be the creator with the creation timestamp, however not 100%.

Could someone translate this query to MS SQL? MS SQL cannot find some objects like 

ao_60db71_sprint
Like YY哥 likes this

Tables starting with ao_xxxx_ are Tables that are created by a Plugin.
xxxx is somewhat the id of the Plugin.

The sprint table is delivered by the "plugin" Jira Software (it is not part of Jira Core).

If you dont find a table by the name ao_60db71_sprint, look for another table with the name ao_xxxx_sprint.

Can I assume that the first entry in the "userhistoryitem" for the sprint's "rapid_view" represents the creator?

/* Find Sprint creator */
DECLARE @SPRINT BIGINT
--
SELECT @SPRINT = 5416
--
SELECT TOP 1 UH.ID, SP.NAME sprintname, USERNAME creator
FROM [My_Jira].[dbo].[userhistoryitem] UH 
INNER JOIN [My_Jira].[dbo].[AO_60DB71_SPRINT] SP WITH(NOLOCK) ON UH.ENTITYID = CAST(SP.RAPID_VIEW_ID AS NVARCHAR)
WHERE SP.ID = @SPRINT;

As per my knowledge, Jira doesn't provide this functionality. 

 

 

I found here that (unfortunately) this info does not seem to be stored in the Jira database

 

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you