Is it possible to revert issue statuses back from a schema change

I applied a schema change to multiple projects, I can get a rough idea of the number of issues impacted but would like a compact way to restore issues to their previous states. audit_item and audit_log don't seem to have the necessary information for a roleback. I am using postgres 9.3 btw.

3 answers

0 vote

What do you mean by "schema change"?  

If you mean you changed schemes, then most of the time, all you do is re-apply the old one

I was able to the projects back to the original schema and all is well there from a functionality side. However the schema that I moved the projects to had different resolution states and when I moved them back a large (>100) number of issues moved back in to the open or reopened state because there wasn't a comparable status in the schema they were migrated from.

For instance there are entries like this in audit_log:

 

11016 |                | 2015-06-29 13:51:20.985-07 | admin        | Workflow scheme removed from project   | workflows        | PROJECT           | 10301                                          | aderem                                                  |                  |                                         |           1 |                   | admin local administrator workflow scheme removed from project workflows aderem classic                                                                                                                                                                       |
 11017 |                | 2015-06-29 13:51:21.031-07 | admin        | Workflow scheme added to project       | workflows        | PROJECT           | 10301                                          | aderem                                                  |                  |                                         |           1 |                   | admin local administrator workflow scheme added to project workflows aderem copy of classic

 

And the corresponding

11098 |                | 2015-06-30 11:32:53.987-07 | admin        | Workflow scheme removed from project   | workflows        | PROJECT           | 10301                                          | aderem                                                  |                  |                                         |           1 |                   | admin local administrator workflow scheme removed from project workflows aderem classic                                                                                                                                                                       |
 11099 |                | 2015-06-30 11:32:54.011-07 | admin        | Workflow scheme added to project       | workflows        | PROJECT           | 10301                                          | aderem                                                  |                  |                                         |           1 |                   | admin local administrator workflow scheme added to project workflows aderem copy of classic

 

After I re-applied the schema on 6-30. The problem is that there issues in that project that have a jiraissue.issuestatus different than they did before application of the new schema on 6/29. I am probably tilting at window mills here but I would like to get the issues in these projects restored to their pre update states.

 

 

I came up with the following query that seems to return about the right number of issues. I know the syntax is messy, any suggestions on cleanup?

select CONCAT (project.pkey, '-', jiraissue.issuenum) , changeitem.newstring  FROM  jiraissue JOIN changegroup ON changegroup.issueid = jiraissue.id JOIN changeitem on changegroup.id = changeitem.id JOIN project ON jiraissue.project = project.id WHERE changegroup.author = 'admin' AND date_trunc('day', changegroup.created) =  '2015-06-29 00:00:00-07'  AND lower(changeitem.newstring) LIKE '%open%' ORDER by changeitem.newstring;

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Sunday in Agility

You asked for it, so we delivered: images on issues have arrived

A picture tells a thousand words. And agility boards have just released their latest feature: cover images on issues – so now your board can tell a story at first glance. Upload attachmen...

189 views 1 11
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you