[rt-users] Removing "Dead" tickets from the db
Vivek Khera
khera at kcilink.com
Wed Aug 27 10:29:22 EDT 2003
>>>>> "MW" == Matthew Watson <mwatson at 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;
More information about the rt-users
mailing list