Created
January 23, 2012 12:09
-
-
Save 4EverBuilder/1662779 to your computer and use it in GitHub Desktop.
SQL To get Redmine CSV export. Can be imported to JIRA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"field.subject" : "summary", | |
"project.lead" : "YOUR USERNAME", | |
"field.category" : "components", | |
"value.status.Closed" : "6", | |
"value.status.New" : "3", | |
"date.import.format" : "yyyy-MM-dd", | |
"value.status.Feedback" : "3", | |
"field.tracker" : "issuetype", | |
"project.name" : "Project", | |
"field.version" : "fixVersions", | |
"field.status" : "status", | |
"field.description" : "comment", | |
"value.status.Resolved" : "5", | |
"field.start_date" : "created", | |
"value.status.QA" : "3", | |
"user.email.suffix" : "@your_domain.com", | |
"field.reporter" : "reporter", | |
"value.status.Assigned" : "3", | |
"date.fields" : "start_date", | |
"field.id" : "issue-id", | |
"value.status.Not a bug" : "6", | |
"project.key" : "YOUR PROJECT KEY", | |
"mapfromcsv" : "false", | |
"value.status.Rejected" : "3", | |
"field.assignee" : "assignee" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
I.id | |
, I.subject | |
, T.name as tracker | |
, CONCAT('Legacy Redmine Link: http://YOUR_REDMINE_INSTALL/issues/' , I.Id , '\n\n\n' , I.description , '\n\n\n' , | |
(SELECT IFNULL(GROUP_CONCAT( CONCAT('On ' , j.created_on , ' ' , (SELECT CONCAT(uj.firstname , ' ' , uj.lastname) FROM users uj WHERE u.id = j.user_id LIMIT 1) , ' wrote :' , j.notes , '\n\n\n' )) , ' ') FROM journals j WHERE j.journalized_id = I.id AND j.journalized_type = 'Issue' AND TRIM(j.notes) != '' ) | |
) as description | |
, C.name as category | |
, S.name as status | |
, u.login as assignee | |
, u2.login as reporter | |
, V.name as version | |
, I.start_date | |
FROM | |
issues I LEFT JOIN users u ON I.assigned_to_id = u.id | |
LEFT JOIN users u2 ON I.author_id = u2.id | |
LEFT JOIN issue_categories C ON C.id = I.category_id | |
LEFT JOIN versions V ON V.id = I.fixed_version_id | |
, issue_statuses S , trackers T | |
WHERE | |
I.project_id = 1 | |
AND S.id = I.status_id | |
AND T.id = I.tracker_id | |
ORDER BY 1; |
I believe you have to create the projects individually in JIRA
And then import them separately as well. Be sure to change the project_id in the above query
Does your command import Redmine bug history (comments) into Jira also?
It merge all comments into "description" field.
To import comments CSV must have multiple columns "comments" with pattern:
{datetime};{authorEmail};{text}
Added attachments and comments:
SELECT
issues.id [Issue Key]
, issues.subject
, trackers.name as tracker
, issues.description
, statuses.name as status
, assignee.login as assignee
, author.login as reporter
, versions.name as version
, issues.start_date
, prioritys.name priority
, issues.created_on
, issues.updated_on
, issues.start_date
, issues.estimated_hours
, issues.parent_id relation
, attachments.[attachment 1], attachments.[attachment 2], attachments.[attachment 3], attachments.[attachment 4], attachments.[attachment 5], attachments.[attachment 6], attachments.[attachment 7], attachments.[attachment 8], attachments.[attachment 9], attachments.[attachment 10]
, comments.[comment 1], comments.[comment 2], comments.[comment 3], comments.[comment 4], comments.[comment 5], comments.[comment 6], comments.[comment 7], comments.[comment 8], comments.[comment 9], comments.[comment 10]
FROM issues
LEFT JOIN users assignee
ON issues.assigned_to_id = assignee.id
LEFT JOIN users author
ON issues.author_id = author.id
LEFT JOIN versions versions
ON versions.id = issues.fixed_version_id
LEFT JOIN issue_statuses statuses
ON statuses.id = issues.status_id
LEFT JOIN trackers
ON trackers.id = issues.tracker_id
LEFT JOIN enumerations prioritys
ON prioritys.id = issues.priority_id and prioritys.type ='IssuePriority'
LEFT JOIN (select issue_id, [attachment 1], [attachment 2], [attachment 3], [attachment 4], [attachment 5], [attachment 6], [attachment 7], [attachment 8], [attachment 9], [attachment 10] from
(select issues.id issue_id,
case
when attachments.id is null then null
else CONCAT(''http://1c-tasks.rtits.ru/attachments/download/'', attachments.id,''/'', attachments.filename)
end attachment,
''attachment '' + cast(ROW_NUMBER() OVER (PARTITION BY issues.id ORDER BY issues.id) as varchar) colnames
FROM
issues
LEFT JOIN attachments on container_id = issues.id and container_type = ''issue'') attachments
PIVOT
(
Max(attachment)
FOR colnames IN ([attachment 1], [attachment 2], [attachment 3], [attachment 4], [attachment 5], [attachment 6], [attachment 7], [attachment 8], [attachment 9], [attachment 10])
) AS PivotTable) attachments
ON attachments.issue_id = issues.id
LEFT JOIN (select issue_id, [comment 1], [comment 2], [comment 3], [comment 4], [comment 5], [comment 6], [comment 7], [comment 8], [comment 9], [comment 10] from
(select issues.id issue_id,
CONCAT(users.login,'';'',CONVERT(nvarchar(30), journals.created_on, 120),'';'',journals.notes) comment,
''comment '' + cast(ROW_NUMBER() OVER (PARTITION BY issues.id ORDER BY issues.id) as varchar) colnames
FROM
issues
LEFT JOIN journals on journals.journalized_id = issues.id and journalized_type = ''Issue''
LEFT JOIN users on users.id = journals.[user_id]) comments
PIVOT
(
Max(comment)
FOR colnames IN ([comment 1], [comment 2], [comment 3], [comment 4], [comment 5], [comment 6], [comment 7], [comment 8], [comment 9], [comment 10])
) AS PivotTable) comments
ON comments.issue_id = issues.id
WHERE
issues.project_id = 7
order by [Issue Key]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Hi, do you know of an easy way to import the projects from redmine to jira using this method? we have our issues broken up into several projects in redmine, and want to keep that organization during the import. many thanks!