Can I insert directly to jira change history? TABLES: changegroup and changeitem?

Jarell Gabon July 14, 2020

I need to insert in those tables to retrieve the changes.

I dont wanna make a new field.

Also is it safe? or itll break something

 

 

2 answers

0 votes
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.
July 14, 2020

Standard advice: 

  • Do not touch a Jira database.  Unless you have a complete understanding of how the parts you want to change work, you will break your Jira.
  • You must never touch a Jira database while Jira is running.  With some trivial exceptions updating non-issue data, you will break your Jira. 
  • If you must edit a Jira database, you need to stop it, take a database backup, restore it somewhere else, test that the backup has worked, make your edits in the target system, restart Jira, run a full locking re-index and integrity check, then test it before letting the users back in.

For your case, you absolutely should not be amending the issue history.  Your changes are not even about the issues, so it would be nonsense to amend the history anyway.

You should be capturing your change logs, probably in dedicated fields, on the issues.  Using the UI or the REST API to push data into them.

Jarell Gabon July 14, 2020

Hi @Nic Brough -Adaptavist- thanks.

I found a solution, i used issueUpdater instead and added changeItemBean

IssueUpdater issueUpdater = ComponentAccessor.getComponentOfType(IssueUpdater.class);
0 votes
Radek Dostál
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.
July 14, 2020

Why would you want to directly insert changelogs?

 

I would advice strongly against it - the db structure is not always entirely clear nor clearly linked in the database schema, you would want to do your research with sql logging to find which tables it actually modifies to see what you need to cover.

 

In any case you are always risking breaking something and Atlassian - as any sane company mind you - is not directly supporting SQL changes.

 

You can generate changeitems on an issue through public Java API if you have a plugin that can run groovy codes (GroovyRunner, ScriptRunner to name 2 I know).

 

In any case changelog should correlate to what changes were done on an issue, so the use case to generate records arbitrarily sounds strange - what information are you trying to capture in it?

Additionally, if your issue changelog is large (say, hundreds or thousands of records), it will affect performance of the issue too - any change or transition you do on that issue will take minutes because it will be trying to generate a new change history, and that will start to take a lot of time. We had some automation that generated thousands of change items and the issue was barely usable (transition took over a minute) and the History tab would take 5 minutes to load.

Jarell Gabon July 14, 2020

Hi @Radek Dostál,

Because when a certain operation is done we wanted to add to change log that this particular issue was modified with this operation. Because we need it for processing.

 

Thanks

Suggest an answer

Log in or Sign up to answer