[rt-users] URGENT - delete tickets from DB

Dimitry Faynerman dimitry.faynerman at hypermediasystems.com
Fri Jun 18 17:08:42 EDT 2004


Thanks Michele,

So basically there are 5 tables need to be cleaned up: Tickets,
TicketCustomFieldValues, Transactions, Attachments, Links

And it should be safe.

 

Jesse, I would appreciate it if you could confirm this.

 

Thanks!

 

Dimitry

 

-----Original Message-----
From: Michele Hershey [mailto:michele.hershey at mhpcc.hpc.mil] 
Sent: Friday, June 18, 2004 12:54 PM
To: Dimitry Faynerman
Subject: Re: [rt-users] URGENT - delete tickets from DB

 

I wrote this and use it

Check against your version and can be critiqued and modified by anyone that
sees any error/conflict/junk.

============


clear
echo Delete Ticket from RT script
echo
echo

while true  # enclose everything in a main while loop
do

echo
echo Please specify a ticket id or 0 to exit:
read ticket_id
echo

if [[ $ticket_id == "0" ]]
then
        exit 0
fi


#### mysql below

user=####

#May uncomment next two lines for Security
#echo Please enter the password
#read pass

pass=######
db=rt2

### Run query sub

run_query()
{
echo "$query" | mysql -u$user -p$pass $db
}

### Find the Subject & Display

query="select Subject from Tickets where id = $ticket_id"
subject=`echo "$query" | mysql -u$user -p$pass $db -s`
echo Subject - $subject

### Accept Action
echo Are you Sure?
echo
echo '( Y/n )'
read reply

if [[ $reply != "Y" && $reply != "y" ]]
then
        exit 0
fi

### Find the Transaction ID

query="select id from Transactions where Ticket = $ticket_id"
trans_id=`echo "$query" | mysql -u$user -p$pass $db -s`
echo Trans_id = $trans_id

### Delete from Attachments

query="delete from Attachments where TransactionId = $trans_id;"

run_query

### Delete from Transactions Table

query="delete from Transactions where Ticket = $ticket_id;"

run_query


### Delete from Watchers Table

query="delete from Watchers where Value = $ticket_id;"

run_query


### Delete from ObjectKeywords Table

query="delete from ObjectKeywords where ObjectId = $ticket_id;"

run_query

### Delete from Links Table

query="delete from Links where LocalBase = $ticket_id;"

run_query

### Delete from Links Table

query="delete from Links where LocalTarget = $ticket_id;"

run_query

### Delete from Tickets Table

query="delete from Tickets where id = $ticket_id;"

run_query

done  # main while loop


Dimitry Faynerman wrote:



Hello,

 

I know that RT doesn’t allow to delete anything forever
but I really need to
delete all tickets from the database

Of course I can manyally delete them from Tickets table. But that won’t be
enough, right?

Which other tables I will have to clean up? Can anybody help with that? It’s
really urgent.

 

Thanks,

 

Dimitry

------------------------------------------------------------
This e-mail may be privileged and/or confidential, and the sender does not
waive any related rights and obligations. Any distribution, use or copying
of this e-mail or the information it contains by other than an intended
recipient is unauthorized. If you received this e-mail in error, please
advise me (by return e-mail or otherwise) immediately. 

Ce courrier électronique est confidentiel et protégé. L'expéditeur ne
renonce pas aux droits et obligations qui s'y rapportent. Toute diffusion,
utilisation ou copie de ce message ou des renseignements qu'il contient par
une personne autre que le (les) destinataire(s) désigné(s) est interdite. Si
vous recevez ce courrier électronique par erreur, veuillez m'en aviser
immédiatement, par retour de courrier électronique ou par un autre moyen.

============================================================

 





  _____  



 
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
 
RT Developer and Administrator training is coming to LA, DC and Frankfurt
this spring and summer.
http://bestpractical.com/services/training.html
 
Sign up early, as class space is limited. 
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20040618/be6eb581/attachment.htm>


More information about the rt-users mailing list