[rt-users] Non-consecutive ticket numbers

Rich Lafferty rich+rt at lafferty.ca
Tue May 28 01:14:45 EDT 2002


On Tue, May 28, 2002 at 07:01:11AM +0200, Florian Weimer (Weimer at CERT.Uni-Stuttgart.DE) wrote:
> Should ticket numbers be consecutive?  Or doesn't it matter at all?

Doesn't matter at all, except that RT::Ticket::Create expects the
database to do the right thing. 
 
> Some people requested the date of creation as part of the ticket
> number, and I wonder if I can increase the sequence number to YYMMDD00
> every night (or even YYMMDD000).

We use YYYYMMDDnnn, which required changing a bunch of fields from
integer to bigint. You should be able to get around that with just
YYMMDD000 (which I'd recommend; one barrage of spam or mail problem
and you've got 100 tickets easy.)

For MySQL, all you should need to do is run this at midnight:

TICKET=$(date +%y%m%d000)
mysql --user=rt_user --pass=PASSWORD rt2 \
      -e "ALTER TABLE Tickets AUTO_INCREMENT = ${TICKET};"

Oh, wait, you'll hit a problem there. RT (well, MySQL) *does* expect
tickets to be integers, not strings, so with YYMMDDnnn, you'll
get a current ticket number of "20528001", not "020528001". There's
something to be said for YYYY -- if you want, I'll send an updated
schema for the bigint ticket numbers. (I *think* I've caught them
all.) The four-digit year is %Y instead of %y in the date command in
the bit above.

Hope this helps,

  -Rich

-- 
Rich Lafferty --------------+-----------------------------------------------
 Ottawa, Ontario, Canada    |  Save the Pacific Northwest Tree Octopus!
 http://www.lafferty.ca/    |    http://zapatopi.net/treeoctopus.html
rich at lafferty.ca -----------+-----------------------------------------------




More information about the rt-users mailing list