Merging two RT databases

Hi,

I was recently asked to merge 2 RT databases together. I don’t need to
import users, queues, or ACLs, but I would like to preserve all tickets
and transactions from the old database. I can’t imagine I’m the first
person who’s had to do this, and I’m wondering if anyone already has a
script written.

Essentially, I would like to iterate through the tickets in the "old"
database and play them back into the “new” one, basically adding a
constant to all ticket numbers and transaction numbers. It doesn’t
matter for my purposes to keep the ticket numbers the same (and would be
impossible at this stage anyway).

I would like to use the RT codebase instead of writing a perl script
that interacts with the MySQL DB directly. I think the latter approach
would be less reliable.

I should also note that I can take RT offline to do the merge if necessary.

Anyway, I’m wondering if anyone has had to do this before and if anyone
already has a script. If I end up writing my own, I will share it with
the list.

Thanks for your time and consideration,
Ross Oldenburg
UWM Center for Gravitation and Cosmology

I would like to use the RT codebase instead of writing a perl script
that interacts with the MySQL DB directly. I think the latter approach
would be less reliable.

If I had to do this, I would use the REST interfaces. Do a REST request to
one RT to get ticket info, then turn around and use the REST interface on
the other to create a new ticket.

Problem is, you don’t specify a ticket number when you create a new ticket.
RT assigns one. If you absolutely have to do that, you’ve no choice but to
dig into the db schema, which will be exponentially more difficult.

But you can always create a special queue just for the merged tickets, or
add a custom field and set its valued to “merged from other system” or some
such, so that you can tell them apart.

I should also note that I can take RT offline to do the merge if necessary.

Shouldn’t be necessary if you can use the REST interfaces. Have a look at
REST - Request Tracker Wiki. There are convenience libraries
already written for both perl and ruby (the latter is my work).

– ============================
Tom Lahti
BIT Statement LLC

(425)251-0833 x 117
http://www.bitstatement.net/
– ============================