Looking to Clear/Reset Issue History

Chris Rondeau
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 12, 2014

We are moving a project from a secure zone to a public zone. Some of the issues previously had sensitive data in them, but have modified for public consumption. We would like to clear the history/changelog, so the previous changes cannot be seen.

We have the project on an interim server, so we can pretty much do whatever.. I've just not seen a clear answer on how to perform this.

3 answers

1 accepted

1 vote
Answer accepted
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 12, 2014

Only way of doing this is to drop the records out of the history using SQL. You'll need to find the stuff you want to destroy in "changeitem" and then check the associated "changegroup" record - if it has no changeitems left, then you should remove that too. For comments, jiraaction is the table to look at. I would not recommend touching anything else though, I don't know them well enough.

Normally, I warn people off SQL tinkering, but in this case, it is moderately safe as long as you keep the changegroup/item relationship above clean. The history is not directly used a lot and there aren't associated counters to update for deleteion. You really do need to do the standard Jira/SQL routine though - shut down Jira, backup the database, prove you can restore it, run your SQL, restart Jira and do a full re-index.

Andrew Wolpers [BlackPearl PDM]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 12, 2014

Nic, would you recommend certain documentation to get queries from for this, or a certain command to clear the tables?

Andrew Wolpers [BlackPearl PDM]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 12, 2014

Sorry, I was half understanding what I was typing. I was essentially asking if you were using "DELETE FROM" or "TRUNCATE" or "REPLACE", whathaveyou. I ended up doing this with "DELETE FROM" and it worked well.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 12, 2014

Not sure what you mean by "certain documentation to get queries from this". If you delete the history data, it's gone, dead, never to be recovered, so there's no queries you can run on it after you destroy it.

I'm not sure about "certain command" either. I would like to jump on the "clear the tables" clause - you absolutely do NOT want to do this. The aim is to destroy some historical data, not the entire system. So you run deletes in SQL to remove the lines you know you don't want.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 12, 2014
Ah, I see. Yes, it's definitely "delete from ... Where ..."
3 votes
r October 25, 2016

If you have script runner plugin you can run the following. replace ABC-1234 with your own issue key. Don't forget to test it in a test env first.

import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.component.ComponentAccessor
def issueManager = ComponentAccessor.getIssueManager()
Issue issue = issueManager.getIssueObject("ABC-1234")
def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()
changeHistoryManager.removeAllChangeItems(issue)
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 25, 2016

Er, that won't actually work - this question is about a version where those calls are different.

Shaun Smith October 26, 2016

I've just run this script from Ravi in 7.1.8 which works (thanks!). 

I was just wondering if there is a way to specify a particular entry from the change history rather than all of the change history?

David Mayer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 1, 2018

Thank you for sharing Ravi, this worked for my instance and saved me a large headache of having to explain to users why they will need to stop work for a period of time while I take out the data.

0 votes
Theinvisibleman
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 12, 2014

Hmm, as far as I know, there really isn't any method to do this except to perform some queries on the database directly to erase them. However, as you might expect, this method can be a tad risky, as there could be quite a number of tables linked to each other that could affect this.

I'd recommend that yuo work with the DBA for this, and make sure you always have a backup on hand, in case anything goes awry.

Suggest an answer

Log in or Sign up to answer