[rt-users] Inserting tickets directly to database

Cerion Armour-Brown cerion at open-works.co.uk
Tue Jun 29 21:02:47 EDT 2004


On Wednesday 30 June 2004 01:37, Peter Silver wrote:
> On Tue, 2004-06-29 at 18:44, Jonas Lindvall (AllTele) wrote:
> > Is there any good way to do this. I have a set of
> > about 4000 tickets from our old text based simple system.
> >
> > And importing thoose to RT is probably pretty
> > simple if i just could figure out how to add a
> > ticket manually, anyone can help??
>
> Surely the easiest way would be to disable any auto-responding Scrips,
> then write a simple script to loop through each ticket and;
>
>   1.  Extract the ticket info from the old data source
>   2.  Compile an email containing the ticket body & attachments, and set
>       the From: address to that of the original sender.
>   3.  Insert a header containing the ticket ID of the original ticket
>       (so you have a way of mapping the old ticket to the new ticket)
>   4.  Send the email to the destination queue address.
>
> That way you wouldn't need to worry about adding the correct info to
> each RT table -- each imported ticket would be handled exactly like a
> new ticket.

This is pretty much what I did when I wanted to import a bunch of (2k5) emails 
into RT - wrote a script to take them from a mail dir, thread them 
(message-id, ref), sort by date and piped them through rt-mailgate.
I also enabled the enhanced-mailgate functionality, so I could resolve, set 
owner etc via following emails.
Worked well, but just for reference, it took around 10 hours to feed them all 
in - slow machine, but even so...
I'm pretty new to perl, so they're messy, but still, if anyone's interested my 
scripts, they're welcome to them.

As a side, from time to time people ask if anyone uses the enhanced-mailgate. 
Well, yes it's insecure, but I don't mind at this point, and I couldn't wait 
for RT3.2++, so I set it up.  It seems to work fine... if anyone wants my 
diffs, yell.

> The only lost info might be the creation date of each ticket, though you
> could easily loop through each ticket again and correct the Created date
> of each transaction associated with the ticket.
Good point, didn't think of this - Would you do this via the cli, or would you 
use the RT api, and maybe take advantage of 'RecordTransaction=0'...?
Cerion



More information about the rt-users mailing list