migrate_from_trac.rake does not convert timestamps in Trac database version 23
In Trac API 0.12, the representation of timestamps was changed from seconds since the epoch
to microseconds since the epoch:
See this patch that changed it in Trac:
If you try to run the existing migrate_from_trac.rake script, the year will be thousands
of years in the future, and the importer will populate the date in redmine is 0000000000.
This causes many things to break.
The problem still exists with the trunk version of the migrate_from_trac.rake script.
In #882 , the user encountered the problem, but went down the wrong path with the fix,
because he didn't understand why timestamps were being imported incorrectly.
I am submitting a better fix, which detects the database version of Trac. If the database
version is > 22, then every time a timestamp from Trac is encountered, we divide by 1 million.
This patch is against trunk.
I have used this patch successfully and it fixes all my problems importing from Trac.
I think many people are hitting these issues when doing Trac -> Redmine migrations. Here are some example tickets:
#12 Updated by Craig Rodrigues over 5 years ago
I have a copy of migrate_from_trac.rake in a Github fork, where I am preserving the patches:
Hopefully my patches can be incorporated into Redmine, so that I don't have to keep my own
private copy. This will benefit others who are trying to migrate to Redmine from Trac.
#15 Updated by Craig Rodrigues over 5 years ago
I'll see what I can do, but can't promise anything. My main reasons for fixing the
migrate_from_trac.rake script to do the following:
However, since I have finished that, I can't devote a lot more time to Remdmine, but I will try if I have time.
I would encourage you to take a whack at learning Ruby and trying to fix this script.
I didn't know Ruby before fixing migrate_from_trac.rake but I learned enough to get going.
The code in Redmine is very clean, so it is easy to pick up.
The code in Redmine which accesses the database is part of the ActiveRecord class in Rails. ActiveRecord
has an API for doing transactions:
Give it a shot and see if you can get something working, and I can review it.