Please, step away from the database. It is NOT designed for reporting in any shape, and there is almost certainly a much better way to do what you want.
Could you explain why you are looking at it? And who gave you the terrible idea of using SQL to do it?
(If you must, then start with changegroup - it has an issue column which is the id of the jiraissue, and then the id column in changegroup is used to identify the changeitems in that group)
By the way, atlassian has documented some parts of it: https://developer.atlassian.com/server/jira/platform/database-change-history/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For anyone else looking to retrieve and process historical data from Jira e.g. for their reports plugin (which was my usecase) and stumbling upon the change* tables in the DB and this question, two suggestions before you dig into building jdbc connections or such things:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Absolutely - SQL is the last approach to getting data, never the first.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Strongly seconding the warning from @Nic Brough -Adaptavist-!!!
That said, some people like to poke around under the hood... :)
Our instance necessitates DB updates sometimes. We use SQL to redact potentially sensitive text without deleting tickets. (Just editing a field doesn't remove the old value from the history tab so sensitive text could still be visible.)
Here is the oracle SQL we use to join all these tables together to basically recreate a ticket's changelog.(Enter your ticket key on the last line) Check out the join clauses to answer your question.
(Works on Jira 6.1+)
SELECT
p.pkey||'-'||i.issuenum as "KEY",
ci.field,
cg.created as Modified,
dbms_lob.substr(ci.oldstring, 4000, 1) as OLD_String,
dbms_lob.substr(ci.newstring, 4000, 1) as NEW_String,
dbms_lob.substr(ci.oldvalue, 4000, 1) as OLD_Value,
dbms_lob.substr(ci.newvalue, 4000, 1) as NEW_Value,
ci.id as Change_Item_Id
FROM changeitem ci
JOIN changegroup cg on ci.groupid = cg.id
JOIN jiraissue i on cg.issueid = i.id
JOIN project p on i.project = p.id
WHERE p.pkey||'-'||I.issuenum in ('KEY-123')
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register NowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.