[Rt-devel] Re: purge tickets from system

Alexey G Misyurenko mag at caravan.ru
Sun Jun 18 16:17:14 EDT 2006


Alexey G Misyurenko wrote:
> Hello!
> Did 'how-to' at
>
>  http://wiki.bestpractical.com/index.cgi?DatabaseAdmin
>
> is still actual to delete ticket, with all depends of it,
> by direct SQL ?
>
>

If customfield is not used, is next steps is anohe to delete ticket
and information associated with it

1. SELECT id FROM tickets WHERE ....
2. SELECT id
     FROM groups
    WHERE
          domain = 'RT::Ticket-Role'
      AND
          instance IN ( /*id's from 1.*/)

3. DELETE
     FROM cachedgroupmembers
    WHERE groupid IN (/* id's from 2. */)


4. DELETE
     FROM principals
    WHERE
          principaltype = 'Group'
      AND
          objectid IN (/* id's from 2. */)

5. DELETE
     FROM GroupMembers
    WHERE groupid IN (/* id's from 2. */)

6. DELETE
     FROM groups
    WHERE id IN (/* id's from 2. */)

7. DELETE
     FROM transactions
    WHERE
          objecttype = 'RT::Ticket'
      AND
          objectid IN (/* id's from 1.*/)

8. DELETE
     FORM tickets
    WHERE id IN (/* id's from 1.*/)


What I miss, except records in links table?

-- 

WBR,   Alexey G Misyurenko ( MAG-RIPE | MMAGG-RIPN )
CTO of Caravan ISP            http://www.caravan.ru
Phone: +7 095 3632252         Cell:  +7 095 5082794



More information about the Rt-devel mailing list