Patch #14593

migrate_from_trac.rake, print out validation errors when doing save

Added by Craig Rodrigues about 9 years ago. Updated almost 9 years ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:


Target version:-


In the migrate_from_trac.rake script,
the save method is called on several objects
to save them to the database. However, if these
objects fail validation, the object is not saved to the database.
The errors are not displayed to the user, and
the migrate_from_trac.rake script will skip saving
many different objects to the database.

This patch preserves the behavior of skipping saving certain
objects if they fail validation, but the patch
will at least try to print out the errors. This will
give the user a chance to scrub the data in Trac
so that it can be properly imported into Redmine.

During my test imports of a large Trac database into Redmine,
I was wondering why certain users and certain tickets were
not being imported into Redmine.

Related to #14567

migrate_from_trac.rake.txt Magnifier (3.74 KB) Craig Rodrigues, 2013-08-01 09:52

migrate_from_trac.rake.patch.2.txt Magnifier (2.68 KB) Craig Rodrigues, 2013-10-13 06:28

Related issues

Related to Redmine - Patch #14567: migrate_from_trac.rake does not convert timestamps in Tra... New


#1 Updated by Craig Rodrigues about 9 years ago

Note, in my patch, I change this:

Time.fake(ticket.changetime) { }



In my patch for #14567 , I got rid of Time.fake,
because I found it did not work all the time and was not necessary.

I am trying to separate my patches to migrate_from_trac.rake
into smaller pieces that can be more easily reviewed and integrated into the Redmine

#2 Updated by Toshi MARUYAMA about 9 years ago

  • Related to Patch #14567: migrate_from_trac.rake does not convert timestamps in Trac database version 23 added

#3 Updated by Marc Schlaich almost 9 years ago

I would say the sane solution is to run the complete script in a database transaction so in case of an error everything is just rolled back. It should be a everything or nothing import strategy. see #14844

#4 Updated by Craig Rodrigues almost 9 years ago

Here is another version of the patch. This patch does not depend on #14567
and just adds more verbose error messages around places where it tries to save to the database.

Also available in: Atom PDF