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,365,234
Community Members
 
Community Events
168
Community Groups

How to delete comments from multiple issues?

We had a little issue with an old FishEye server that was running in two instances with the same database. (Clone for test instance was misconfigured)

This caused that the same smart commits repeatedly triggered creation of comments in Jira Issues before we noticed the problem. We were able to narrow down the comments in the database table by user and time frame and identified more than 23k were created within 48 hours.

Now we are looking for the best way to delete those comments without causing any database inconsistencies. Is there any option via UI or API to delete the comments in bulk?

Is this something we should remove directly in the database.

I noticed the comments are stored in the table JIRAACTION and the comments are referenced as well in table COMMENT_VERSION. Is there any other tables that can contain references? Is it fine to shut down the server remove the faulty comments and restart the it?

1 answer

0 votes

Hi @Sebastian G 

 

If you have scriptrunner you can write a scriptconsole to remove those comments.

https://docs.atlassian.com/software/jira/docs/api/8.0.0/index.html?com/atlassian/jira/issue/comments/CommentManager.html

 

Regards

@Florian Bonniec: Thanks for the quick reply.

Unfortunately, we do not have the ScriptRunner plugin and we may have used the plugins free trial before and won't be able to install it without paying the full price which is no option.

What I might be able to do is to export the comment ids and issue keys from our database and than use POSTMAN as BatchRunner and run against the REST API https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-rest-api-3-issue-issueidorkey-comment-id-delete .

That just might be painfully slow compared to two database delete statements.

You can try to delete in the db directly in a staging env, but it's always cleaner to use the UI or the API.

 

You can write a python script instead of using Postman.

 

Make sure to use the correct API, not the cloud one.

https://docs.atlassian.com/software/jira/docs/api/REST/8.22.6/#issue-deleteComment

 

Regards 

My concern with the UI and the API is that it might only be a shallow soft delete and that the unnecessary lines in the database remain.

I usually prefer doing it through the app as the app will clean whatever it has to clean. Doing it in the db directly is a risk to forgot something and can lead to issues later.

 

If you want to do it in the db, try it in a test environment first, then load 1 issues impacted to see if there is any error.

 

Regards 

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events