Project

General

Profile

Trac import into an Existing Redmine Site

Added by Chris Platts over 16 years ago

Hi,

Is there any workaround to the requirement that a migration from Trac be done with an empty Redmine installation?

I'd really like to bring an existing Trac project into our live and much-used Redmine system. Perhaps I could do the migration into a second, fresh Redmine installation - then import from that Redmine site to the 'live' one?


Replies (8)

RE: Trac import into an Existing Redmine Site - Added by Carl Nygard over 16 years ago

One of the problems is that the id's of internal issue links, and especially subversion commit messages are still tied to the original id's in trac. If your redmine installation is using the same issue ids, you'll get massive confusion.

I had the same issue with importing an existing bugzilla, and I solved it by resetting the current issue id in the redmine database above the last bugzilla issue id, then did the import. Of course, I had to write the importer myself, so I had control over some of these issues, but if I hadn't set the redmine issue id, it would have been impossible.

YMMV

RE: Trac import into an Existing Redmine Site - Added by Chris Platts over 16 years ago

Thanks for the reply!

Luckily, my requirements are relatively straightforward. I'd be quite satisfied with simply the ticket information (without even the updates) and the status. There are only a handful of ticket reporters and assignees which I could easily hard-code.

My DB skills lie in .NET, not PHP or Ruby, sadly (I'm working on fixing that! :-). There are ADO.NET providers available for both MySQL (which I'm using with Redmine) and SQLite (Trac). I think I might try to start out with those and see how far I get!

I'm on a one-man mission to move my colleagues from the dreaded Visual Source(un)Safe. I've been using Redmine+SVN for a month now and the difference is like night & day. Since the project was stuck in SourceSafe, we'd not used Trac's SVN integration. I'm hoping to move the codebase to SVN and the issue/feature tracking for that project from Trac to Redmine.

Even if the ticket migration isn't feasible, I'll go as far as manually re-entering currently active tickets just to get us all on the same Redmine+SVN platform and rescue my sanity :)

RE: RE: Trac import into an Existing Redmine Site - Added by Carl Nygard over 16 years ago

In that case, since it doesn't seem that you have any commits that reference your issue ids, you can probably use the stock trac importer. You may want to look through the code, and perhaps remove some of the stuff it's doing, like registering users automatically or whatnot. But the key is the trac importer figures out what the new issue id will be in redmine, and makes efforts to re-write references in docs and wiki pages accordingly. I don't think you'll have a huge problem understanding the flow and what to do. Just do it with a test database a few times until you're sure it's going well.

BTW, someone may correct me, but I believe the only reason why the trac migration should be done with an empty redmine install is because of the issue id rewriting problem I mentioned earlier. I believe the code takes steps to only add certain items (like users) if they don't already exist.

RE: Trac import into an Existing Redmine Site - Added by Chris Platts over 16 years ago

Thanks Carl -- I'll look at the existing importer first. Better to tweak something that already works than re-invent the wheel.

I'll grab a copy of the redmine database at work today and see what I can do over the weekend.

Cheers,
Chris

RE: RE: Trac import into an Existing Redmine Site - Added by Mark P over 16 years ago

Were you successful in writing/tweaking the stock trac importer? We are thinking of doing something similar for Serena Tracker.

RE: Trac import into an Existing Redmine Site - Added by Chris Platts over 16 years ago

Hi Mark,

I ended up just doing it pretty much manually. First, I dumped trac's sqlite database to a text file. I followed a couple of guides about sanitising a sqlite dump so that mysql can understand it. Then I imported that converted sql script into a new, temporary mysql database.

Then I simply ran some INSERT INTO statements in mysql to copy data from that temporary database into the redmine db, using constants to replace user ids and a few additional tweaks (e.g. trac stores timestamps as UNIX-style timestamp long ints, whereas redmine uses the datetime type). All in all, it was rather hackish, but my needs were very simple (only a handful of unique trac users and not even any need to copy across ticket updates).

RE: Trac import into an Existing Redmine Site - Added by Mark P over 16 years ago

Chris,

I was planning to follow a very similar approach, so many thanks for validating that for me. Do you have an entity diagram for the Redmine schema so you knew how to insert the data? Right now that looks to be my biggest hurdle as I don't want to corrupt the data by inserting it incorrectly. I will be migrating data from multiple MS SQL Server databases into Redmine, so I will have to run the process multiple times. I may end up dumping the MS stuff to a temp mysql as you did, as I think I have date format/type mismatches too.

RE: Trac import into an Existing Redmine Site - Added by Chris Platts over 16 years ago

I didn't find a schema, unfortunately.

I just browsed the redmine db via my Webmin interface to mysql and opened a load of browser tabs containing different table definitions and table data. Then I just hand-entered the SQL statements... had a notepad (the dead-tree variety!) sat next to me to ensure I kept track of where I was.

Very old-school approach, I know :)

    (1-8/8)