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

John Wallach July 1, 2015

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 votes
John Wallach July 2, 2015

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;
0 votes
John Wallach July 1, 2015

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.

 

 

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 1, 2015

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

Suggest an answer

Log in or Sign up to answer