Hello world,
I wanted to share some frustration regarding the general lack of support for exporting & importing Active Objects based data which a lot of JIRA plugins tend to use.
For those of you who are voting madly on https://jira.atlassian.com/browse/JRA-28748 this might help you if you're faced with:
- Migrating from an OD JIRA Instance to a Standalone version
- Your Standalone version already exists & you need to merge the OD data with your existing Standalone project by project
- You only care about saving the "Sprint" fields & the Boards which use them
Where possible I really encourage you to "Restore System" from the OD XML dump rather than going project by project, so if your organisation is moving away from OD then really consider moving the while OD XML backup to Standalone & then manipulate from there - going project by project is hard, but not impossible.
In my case I had to preserve the "Sprint" custom field values in particular - I didn't care about rank or some of the other information - this is where the "Some" comes from in the summary.
You'll probably already know that you can't just import the value of the Custom Field for the JIRA Agile fields - they import but don't link up with the Boards.
As with most project by project imports I'm assuming you've already taken care of workflows, custom fields, screens, permissions, priorities, roles etc. etc. etc. then created an empty project that you want as a container for the resulting import.
- Make a backup of the OD instance
- Take this backup & system restore it into a Standalone instance matching your final Production instance version
- Make sure that you install & get trial licenses for all of the OD plugins you had installed
- Reconnect the Marketplace in the Addons area
- Conduct an XML backup on this Standalone instance
Now the fun begins
- On your production system duplicate the Boards you created in OD, this should also include any filters which were made in OD too
Using the database of your Standalone instance (the one you imported OD into) export out the AO_xxxxx_SPRINT & AO_xxxxx_AUDITENTRY tables, this should be done ideally to ASCII as INSERT statements. These contain the information associated with the "Sprint" custom field
The names of the tables can be taken from the Plugin Data Storage list in the System admin area
sudo -u postgres pg_dump -a --inserts -t \"AO_60DB71_SPRINT\" -t \"AO_60DB71_AUDITENTRY\" jira > AO_60DB71.sql
- Grab a mapping of the RAPID_VIEW_ID's for all your boards in OD vs. your Production Instance (you can grab this by navigating to the board & grabbing it from the URL)
Change the entries in the AO_xxxxx_SPRINT table so that the RAPID_VIEW_ID's align with your Production Instance, something like
UPDATE "AO_60DB71_SPRINT" set "RAPID_VIEW_ID" = 6 WHERE "RAPID_VIEW_ID" = 3;
UPDATE "AO_60DB71_SPRINT" set "RAPID_VIEW_ID" = 5 WHERE "RAPID_VIEW_ID" = 12;
UPDATE "AO_60DB71_SPRINT" set "RAPID_VIEW_ID" = 4 WHERE "RAPID_VIEW_ID" = 13;
- Insert the munged AO_xxxxx_SPRINT & AO_xxxxx_AUDITENTRY tables with the updated mappings into your target system
- Stop the target system JIRA instance & then start it again, once running reindex
- You should then see your Sprints in the empty boards & they'll have the backend ID's which the original OD version did (important because we're going to remap them all)
Back on the Standalone system we now need to grab all the customfieldvalues for all the Sprint fields for the old issues, we're going to use this to edit all the post imported issues later to populate out boards
You need to know 2 things: the custom field id of the source system & the destination for the Sprint field
In my systems this was 10007 for the source & 10306 for the destination (you can get this from the Custom fields page in the Admin area of JIRA by clicking on edit or view, grabbing it from the URL)
Then run this, changing the field id's to suit:
IFS=$'\n';
for l in `sudo -u postgres psql -t -c "select p.pkey || '-' || i.issuenum,c.stringvalue from customfieldvalue c join jiraissue i on c.issue = i.id join project p on i.project = p.id where c.customfield = 10007" jira | sort -k 1`; do
id=$(echo ${l} | awk -F\| '{print $1}' | sed "s/ //g");
sprint=$(echo ${l} | awk -F\| '{print $2}' | sed "s/ //g");
echo curl -D- -u \$\{u\}:\$\{p\} -X PUT -H \'Content-Type: application/json\' -d \'{ \"fields\" : { \"customfield_10306\": \"${sprint}\" } }\' \$\{h\}/rest/api/2/issue/${id}
doneThe above will output a bunch of Curl commands to hit the REST API and set the desired Sprint ID on the issue, where:
u = the username to auth as
p = the password for the username
h = the hostname to hit where the REST API is
Keep this shell script for later on
Now we're ready to do the project import - do this normally via the JIRA Admin interface, you should have no errors (watch out for https://jira.atlassian.com/browse/JRA-41681 too)
- Ensure that the workflow bound to the recently imported project allows for editing of all issues (including closed ones), so that we can sort the history out
- Now run the shell script which will modify all the issues & set the proper Sprint CF value
- At this point your Boards should start populating based on the Sprint values being set, you'll also notice that the reports will show past Sprints & the issues associated with them
There's obviously no warranty on this & Atlassian most certainly won't help you with this (other than to point you at an "expert")
It works though, good luck if you want to give it a go