Import: Migrate One-To-Many Relationships To JIRA Using CSV Import

AnonyMe January 28, 2013

JIRA 5.2:

I am migrating issues from an old bug tracking system to JIRA using the CSV import feature. I have exported the main issues table to a CSV file, but there are related tables that have a one-to-many relationship with the issues, for example, audit trail of incident updates, as well as attachments for each issue.

I see how to import the issues, but not how to import related records -- possibly multiples -- for each issue. Is there a way to preserve the related data in the migration?

3 answers

1 accepted

1 vote
Answer accepted
Pawel Niewiadomski
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.
January 28, 2013

@Renjith, actually we support importing issue history now.

@AnonyMe - so to preserve one-to-many relationships in CSV file you use just multiple columns for the same item, like you can have multiple columns named Comment and they will be automatically combined, the same goes for other items like Attachment, Label, etc.

Building such a complex file might be tricky so I suppose you would want to make a script that will dump the original database to it - so you can easily iterate with your work.

Also if you want to have a more structured file (and more control over CSV) you can try using our JSON (beta) format. But this is an advanced technique. Here's some documentation https://confluence.atlassian.com/pages/viewpage.action?pageId=293830712

AnonyMe January 28, 2013

@Pawel - thanks for the advice, although I am still confused. Each issue that I am migrating can have zero or more updates, so how do I account for this variable number of updates per issue by adding columns to my CSV file?

I will look into the article on using JSON, but I could also do a direct migration from one database to the other, either through updatable views or through export/import since both the source and the target databases are SQL Server (albeit different versions). Is there anything I need to be mindful of once I familiarize myself with the JIRA structure, like triggers, etc.?

I found the latest data schema documentation on your website, athough I have to say it is very hard to read and seems not very printer-friendly.

Thanks again for your help!

Pawel Niewiadomski
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.
January 29, 2013

To create a propert CSV file in this case you'd have to create a script that would keep all records in history and then check what's the biggest numer of changes, attachments, comments, etc. and create so many columns for them. In case of issues having less items columns can be empty.

I guess using JSON in this case would be more intuitive for your - as each object is really well structured and can contain different details than others.

I know that some customers do copy data directly to JIRA database. I'm not an expert on that. The one thing to remember is to update all sequences correctly. I've created a Trac to JIRA importer using database directly couple of years ago, I know it's doable, but required couple of days to figure out all issues. I think JIRA Data Generator source code may give you some hints about iternal db structure. But I might be wrong.

AnonyMe January 29, 2013

ok, I understand my options. I will investigate the JSON approach first. Thank you for your responses.

0 votes
Wojciech Seliga
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.
January 28, 2013

You can import historical data by using JSON importer (beta) - part of JIRA Importers Plugin bundled with JIRA. But that will require some data pre-processing (into JSON format understood by the importer) on your side.

If you want just to stick to CSV import, then you can play with issue update capaiblity offered by it. I.e. if you denote one of your columns in CSV as the issue key (which has to match an issue key already in JIRA), then you can effectively update an existing issue and thus import changes to its status, field values or e.g. import more worklog information.

0 votes
Renjith Pillai
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.
January 28, 2013

Issue history import is not supported using CSV, AFAIK. While attachments can be done as documented at https://confluence.atlassian.com/display/JIRA/Importing+Data+from+CSV#ImportingDatafromCSV-Importingattachments

Suggest an answer

Log in or Sign up to answer