I’m writing a quick script to import tickets from an Excel spreadsheet
into RT 3.0.6, based on a couple of things I’ve found in the contrib
directories, and I have a couple of questions.
First, some background:
We’ve needed to start using RT already, so I’ve bumped up the MySQL
auto_increment starting number to 1000, and I’m going to insert the old
tickets from the spreadsheet at numbers below that. Hence, I don’t think
I can use either the RT CLI (couldn’t get it to work anyway) or any of
the RT:: classes to create my tickets, because they’ll just use the
auto_increment id provided by MySQL. So I’m going directly to the
database, and I want to make sure I’m doing the operations right to
preserve the db integrity.
The specific question I have is about Transactions and Attachments.
As I understand it, each time I add a row to Tickets I should also add a
row to Transactions of type=‘Create’ to record the creation of the
Ticket. But do I need to add an entry to Attachments as well, or is that
optional?
My current guess is that it’s optional depending on whether there is any
descriptive content for the ticket (if so, put it in an attachment; if
not, you don’t need an attachment). Is that right? Or should I be adding
an attachment for each Ticket regardless of whether there’s any
description?
A related question is regarding the Headers field in the Attachments
table. Is it relied on for anything, or is it just for reference?
You might want to look at one of the RT import scripts for guidance. I
did something quite similar to what you are doing and found that using
it as a basis for my custom import script was far more effective than
writing it from scratch. (Notwithstanding the fact that I did end up
replacing most of it.) You can definitely use the existing classes to
create things with specific ticket numbers.
You might want to look at one of the RT import scripts for guidance. I
did something quite similar to what you are doing and found that using
it as a basis for my custom import script was far more effective than
writing it from scratch. (Notwithstanding the fact that I did end up
replacing most of it.)
That’s what I’m doing, working with F2Wcvs-to-rt-3_0 as a basis and
modifying it to suit my needs. (any others you could recommend? this is
the only import script for RT3 I’ve found so far.) And as you said, I’m
finding that I’m having to replace most of it, but it’s a good place to
start. But the question is…
You can definitely use the existing classes to create things with
specific ticket numbers.
How do I do this? I don’t know whether it’s just me, but I’m finding the
RT class structure really difficult to get my head around, and I haven’t
seen any way to do what you suggest. Obviously that would be great, but
on the other hand I think it will be faster just to use DBI and insert
stuff into the database myself than trawl through the code and
inheiritances trying to figure out what’s doing what.
Also, the script I’m working from creates Transactions and Attachments
separately as well, so that still doesn’t answer my initial question of
whether Attachments have to be created for each Create transaction or
are optional.