Project

General

Profile

Using importer to change issues' IDs

Added by Harry Garrood over 12 years ago

I have used https://github.com/leovitch/redmine_importer/wiki successfully to import a load of issues into Redmine.
Now I am trying to import the same csv again, in order to change all the IDs to the IDs in our old system.
Unfortunately, I am receiving an error:

NoMethodError in ImporterController#result
undefined method `project_id' for nil:NilClass

I have done a bit of googling, and apparently this error often has something to do with MySQL database integrity issues? However, the first import (ignoring ID) did work, so I am a bit stuck.
Any help would be much appreciated!

EDIT: If anyone else is having this issue, I solved it by creating an external ID field to import with, and then running this SQL on the redmine mysql database:

update issues,custom_values
set issues.id=issues.id+10000 (NOTE: this needs to be an integer, larger than the highest issue ID),
    custom_values.customized_id=custom_values.customized_id+10000 (same as above);

create temporary table temp (
    customized_id integer
    value integer
);

insert into temp
select 
    customized_id, 
    value
from custom_values 
where custom_field_id = 9 (this needs to be an 'external id' custom field's id);

update issues, temp
    set issues.id = temp.value
where issues.id = temp.customized_id;

update custom_values, temp
    set custom_values.customized_id = temp.value
where custom_values.customized_id = temp.customized_id;

alter table issues auto_increment 3000;

drop table temp;

After this, the redmine ID should have been set to the external ID.