Removing "Dead" tickets from the db

Heya all.

I’m wanting to clean up my RT2 database a bit, starting with removing all
the “dead” tickets from the db completely.

Awhile ago there was a script floating around to do this, but the only url
I can find for it seems to be dead. Anyone have this script? or a similar
script to remove dead tickets?

Thanks.
Matthew Watson
Netspace Online Systems.

“MW” == Matthew Watson mwatson@netspace.net.au writes:

MW> Heya all.
MW> I’m wanting to clean up my RT2 database a bit, starting with removing all
MW> the “dead” tickets from the db completely.

with the following referential integrity checks in place, it is a
simple as “delete from tickets where status=‘dead’”

ALTER TABLE Transactions ADD CONSTRAINT transfk1 FOREIGN KEY (Ticket) REFERENCES Tickets(id) MATCH FULL ON DELETE CASCADE;
ALTER TABLE Attachments ADD CONSTRAINT attachfk1 FOREIGN KEY (TransactionID) REFERENCES Transactions(id) MATCH FULL ON DELETE CASCADE;
ALTER TABLE Watchers ADD CONSTRAINT watchfk1 FOREIGN KEY (Value) REFERENCES Tickets(id) MATCH FULL ON DELETE CASCADE;
ALTER TABLE ObjectKeywords ADD CONSTRAINT objectfk1 FOREIGN KEY (ObjectId) REFERENCES Tickets(id) MATCH FULL ON DELETE CASCADE;
ALTER TABLE Links ADD CONSTRAINT linksfk1 FOREIGN KEY (LocalTarget) REFERENCES Tickets(id) MATCH FULL ON DELETE CASCADE;
ALTER TABLE Links ADD CONSTRAINT linksfk2 FOREIGN KEY (LocalBase) REFERENCES Tickets(id) MATCH FULL ON DELETE CASCADE;