How to change the author of a comment in Jira

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the server and data center platforms.

Direct database modifications are not supported by Atlassian. Always back up Jira's database before performing any modification to it.

Summary

If you need to  change the author of a Jira comment, the only way possible is to modify the jiraaction table in the database where the comments are stored. 

Environment

Applicable to all versions of Jire Core and Software 7.x/8.x and Jira Service Management 3.x and 4x.

Solution

 Please test these steps in your staging environment before performing the changes in production 

There are five steps needed to change the comment authors:

  1. Shutdown Jira
  2. Identifying the issueid of the issue that needs to be changed
  3. Identifying the ID of both users
  4. Updating the jiraaction table and changing the author
  5. Start Jira

We will work through the following example where we want to change the comment author from "clevine" to "thor".

The first query is simply to get the issue id:

select id from jiraissue I join project P on P.id = I.project where P.pkey = 'GOT' and I.issuenum = 1;

Result:

id
10000

Next, we need to get the ID of both users, we can query the cwd_user table for the two users with a similar query:

select AU.* from cwd_user CU join app_user AU on AU.lower_user_name = CU.lower_user_name where user_name in ('clevine','thor');


Result:

iduser_keylower_user_name
10000JiraUSER10000clevine
10100JiraUSER10100thor


With this, we can then modify the jiraaction table. 

The author format in the jiraaction table is the user_key, with an example being JiraUSER10000.

 Our next would then be to change the author from clevine to thor with the following query:

update jiraaction set author = 'JiraUSER10100' where author = 'JiraUSER10000' and actiontype = 'comment' and issueid = 10000;


Once this query has been run, please start Jira and confirm the expected changes are present:

Result:



Last modified on Nov 23, 2020

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.