Deleting tickets 2

Sorry but after some investigation i finally figured out a way to do it.

Is this correct (Simple example):
select id from Transactions where Ticket=2700;
| id |
| 6962 |
delete from Attachments where TransactionId=6962;
delete from Tickets where id=2700;

Is that all i need to do?

Regards,
Steve Poirier
Project Manager
Inet-Technologies inc.

You’ll also want to delete rows from the ObjectKeywords table and from the
Watchers table that correspond to the ticket in question. At some point,
I’m planning on doing up a reaper script that can do this automatically for
“dead” tickets.On Sat, Aug 04, 2001 at 12:51:56PM -0400, Steve Poirier wrote:

Sorry but after some investigation i finally figured out a way to do it.

Is this correct (Simple example):
select id from Transactions where Ticket=2700;
±-----+
| id |
±-----+
| 6962 |
±-----+
delete from Attachments where TransactionId=6962;
delete from Tickets where id=2700;

Is that all i need to do?

Regards,
__
Steve Poirier
Project Manager
Inet-Technologies inc.


rt-users mailing list
rt-users@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-users

jesse reed vincent – root@eruditorum.orgjesse@fsck.com
70EBAC90: 2A07 FC22 7DB4 42C1 9D71 0108 41A3 3FB3 70EB AC90

. . . when not in doubt, get in doubt. – Old Discordian Proveb

Thanks! So, what i need to do is:

select id from Tickets where Status=‘dead’;

You delete the Tickets where status is dead

Loop 1 with the array of dead tickets:
select id from Transactions where Ticket=‘$ticketid’;

Loop 2 with array of transactions for this ticket

You delete all rows in Attachments where TransactionID = TransactionIDs

End loop 2

You delete all rows in table Transactions where Ticket=‘$ticketid’;

You delete all rows in table Watchers where Value=‘$ticketid’;

You delete all rows in table ObjectKeywords where ObjectId=‘$ticketid’;

end loop 1

Is that it? If yes, i’ll read the DBD-MySQL faq and build a perl script,
is it ok if i submit it to the list after testing?

Regards,
Steve Poirier
Project Manager
Inet-Technologies inc.From: “Jesse” jesse@fsck.com
To: “Steve Poirier” steve@inet-technologies.com
Cc: rt-users@lists.fsck.com
Sent: Saturday, August 04, 2001 2:00 PM
Subject: Re: [rt-users] Deleting tickets 2

You’ll also want to delete rows from the ObjectKeywords table and from the
Watchers table that correspond to the ticket in question. At some point,
I’m planning on doing up a reaper script that can do this automatically
for
“dead” tickets.

Sorry but after some investigation i finally figured out a way to do it.

Is this correct (Simple example):
select id from Transactions where Ticket=2700;
±-----+
| id |
±-----+
| 6962 |
±-----+
delete from Attachments where TransactionId=6962;
delete from Tickets where id=2700;

Is that all i need to do?

Regards,
__
Steve Poirier
Project Manager
Inet-Technologies inc.


rt-users mailing list
rt-users@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-users


jesse reed vincent – root@eruditorum.orgjesse@fsck.com
70EBAC90: 2A07 FC22 7DB4 42C1 9D71 0108 41A3 3FB3 70EB AC90

. . . when not in doubt, get in doubt. – Old Discordian Proveb


rt-users mailing list
rt-users@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-users

Be forewarned, that I’m half-way through my trip home from the west caost and rather out of it. (I just typed east coast without really seeing anything wrong with it :wink: But yeah, that sounds about right. You should actually be able to do all of this from within RT’s API, but feel free to build at least a first draft with the tools you know. (There’s a tool to whack just one attachment in /contrib) And yes, of course we welcome anything you’d like to controbute back.

Jesse, from Newark International Airport, Gate 111On Sat, Aug 04, 2001 at 06:25:50PM -0400, Steve Poirier wrote:

Thanks! So, what i need to do is:

select id from Tickets where Status=‘dead’;

You delete the Tickets where status is dead

Loop 1 with the array of dead tickets:
select id from Transactions where Ticket=‘$ticketid’;

Loop 2 with array of transactions for this ticket

You delete all rows in Attachments where TransactionID = TransactionIDs

End loop 2

You delete all rows in table Transactions where Ticket=‘$ticketid’;

You delete all rows in table Watchers where Value=‘$ticketid’;

You delete all rows in table ObjectKeywords where ObjectId=‘$ticketid’;

end loop 1

Is that it? If yes, i’ll read the DBD-MySQL faq and build a perl script,
is it ok if i submit it to the list after testing?

Regards,
__
Steve Poirier
Project Manager
Inet-Technologies inc.

----- Original Message -----
From: “Jesse” jesse@fsck.com
To: “Steve Poirier” steve@inet-technologies.com
Cc: rt-users@lists.fsck.com
Sent: Saturday, August 04, 2001 2:00 PM
Subject: Re: [rt-users] Deleting tickets 2

You’ll also want to delete rows from the ObjectKeywords table and from the
Watchers table that correspond to the ticket in question. At some point,
I’m planning on doing up a reaper script that can do this automatically
for
“dead” tickets.

On Sat, Aug 04, 2001 at 12:51:56PM -0400, Steve Poirier wrote:

Sorry but after some investigation i finally figured out a way to do it.

Is this correct (Simple example):
select id from Transactions where Ticket=2700;
±-----+
| id |
±-----+
| 6962 |
±-----+
delete from Attachments where TransactionId=6962;
delete from Tickets where id=2700;

Is that all i need to do?

Regards,
__
Steve Poirier
Project Manager
Inet-Technologies inc.


rt-users mailing list
rt-users@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-users


jesse reed vincent – root@eruditorum.orgjesse@fsck.com
70EBAC90: 2A07 FC22 7DB4 42C1 9D71 0108 41A3 3FB3 70EB AC90

. . . when not in doubt, get in doubt. – Old Discordian Proveb


rt-users mailing list
rt-users@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-users

jesse reed vincent – root@eruditorum.orgjesse@fsck.com
70EBAC90: 2A07 FC22 7DB4 42C1 9D71 0108 41A3 3FB3 70EB AC90

A REAL sysadmin challenge is “resurrect five dead mailserver while so ripped
to the gills on mdma that you can’t focus on any given line of text for more
than 10 seconds continuously.”
-Nathan Mehl

“SP” == Steve Poirier steve@inet-technologies.com writes:

SP> Thanks! So, what i need to do is:
SP> select id from Tickets where Status=‘dead’;

SP> You delete the Tickets where status is dead

Wow… pretty complex. Foreign keys would make this much easier.
Just declare a foreign key with ON DELETE CASCADE on the tables that
link back to ticket ID, then deleting the ticket ID in that table
would cascade the delete across to the other tables. I guess this
wouldn’t work in MySQL, though…

Vivek Khera, Ph.D. Khera Communications, Inc.
Internet: khera@kciLink.com Rockville, MD +1-240-453-8497
AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/

Well i wrote the script and it work in MySQL. Thats the important thing for
me because the programmers who write ‘nice code’ here are very very busy :slight_smile:
but thanks for the advice.

Steve Poirier
Project Manager
Inet Technologies Inc.----- Original Message -----
From: “Vivek Khera” khera@kcilink.com
To: rt-users@lists.fsck.com
Sent: August 6, 2001 10:17
Subject: Re: [rt-users] Deleting tickets 2

“SP” == Steve Poirier steve@inet-technologies.com writes:

SP> Thanks! So, what i need to do is:
SP> select id from Tickets where Status=‘dead’;

SP> You delete the Tickets where status is dead

Wow… pretty complex. Foreign keys would make this much easier.
Just declare a foreign key with ON DELETE CASCADE on the tables that
link back to ticket ID, then deleting the ticket ID in that table
would cascade the delete across to the other tables. I guess this
wouldn’t work in MySQL, though…


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Ph.D. Khera Communications, Inc.
Internet: khera@kciLink.com Rockville, MD +1-240-453-8497
AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/


rt-users mailing list
rt-users@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-users

I have the same problem. And each time it occurs, I have the following
line in the logs:

[Mon Aug 6 12:34:04 2001] [notice] child pid 25491 exit signal
Segmentation fault (11)

And the CSS problem occurs only when I have seg fault.
I didn’t try to check yet what is causing the seg fault.From: Jesse [mailto:jesse@fsck.com]
Sent: dimanche, 5. août 2001 12:38
To: Steve Poirier
Cc: rt-users@lists.fsck.com
Subject: Re: [rt-users] Deleting tickets 2

Be forewarned, that I’m half-way through my trip home from the west
caost and rather out of it. (I just typed east coast without really
seeing anything wrong with it :wink: But yeah, that sounds about right.
You should actually be able to do all of this from within RT’s API, but
feel free to build at least a first draft with the tools you know.
(There’s a tool to whack just one attachment in /contrib) And yes, of
course we welcome anything you’d like to controbute back.

Jesse, from Newark International Airport, Gate 111

I nearly was going to correlate the CSS problem to the seg fault, but it’s
difficult to prove. I’d say I’m having the same problem.

Dave

David C. Troy [dave@toad.net] 410-544-6193 Sales
ToadNet - Want to go fast? 410-544-1329 FAX
570 Ritchie Highway, Severna Park, MD 21146-2925 www.toad.netOn Mon, 6 Aug 2001, Rafael Corvalan wrote:

I have the same problem. And each time it occurs, I have the following
line in the logs:

[Mon Aug 6 12:34:04 2001] [notice] child pid 25491 exit signal
Segmentation fault (11)

And the CSS problem occurs only when I have seg fault.
I didn’t try to check yet what is causing the seg fault.

-----Original Message-----
From: Jesse [mailto:jesse@fsck.com]
Sent: dimanche, 5. août 2001 12:38
To: Steve Poirier
Cc: rt-users@lists.fsck.com
Subject: Re: [rt-users] Deleting tickets 2

Be forewarned, that I’m half-way through my trip home from the west
caost and rather out of it. (I just typed east coast without really
seeing anything wrong with it :wink: But yeah, that sounds about right.
You should actually be able to do all of this from within RT’s API, but
feel free to build at least a first draft with the tools you know.
(There’s a tool to whack just one attachment in /contrib) And yes, of
course we welcome anything you’d like to controbute back.

Jesse, from Newark International Airport, Gate 111

On Sat, Aug 04, 2001 at 06:25:50PM -0400, Steve Poirier wrote:

Thanks! So, what i need to do is:

select id from Tickets where Status=‘dead’;

You delete the Tickets where status is dead

Loop 1 with the array of dead tickets:
select id from Transactions where Ticket=‘$ticketid’;

Loop 2 with array of transactions for this ticket

You delete all rows in Attachments where TransactionID =
TransactionIDs

End loop 2

You delete all rows in table Transactions where Ticket=‘$ticketid’;

You delete all rows in table Watchers where Value=‘$ticketid’;

You delete all rows in table ObjectKeywords where
ObjectId=‘$ticketid’;

end loop 1

Is that it? If yes, i’ll read the DBD-MySQL faq and build a perl
script, is it ok if i submit it to the list after testing?

Regards,
__
Steve Poirier
Project Manager
Inet-Technologies inc.

----- Original Message -----
From: “Jesse” jesse@fsck.com
To: “Steve Poirier” steve@inet-technologies.com
Cc: rt-users@lists.fsck.com
Sent: Saturday, August 04, 2001 2:00 PM
Subject: Re: [rt-users] Deleting tickets 2

You’ll also want to delete rows from the ObjectKeywords table and
from the Watchers table that correspond to the ticket in question.
At some point, I’m planning on doing up a reaper script that can do
this automatically
for
“dead” tickets.

On Sat, Aug 04, 2001 at 12:51:56PM -0400, Steve Poirier wrote:

Sorry but after some investigation i finally figured out a way to
do it.

Is this correct (Simple example):
select id from Transactions where Ticket=2700;
±-----+
| id |
±-----+
| 6962 |
±-----+
delete from Attachments where TransactionId=6962;
delete from Tickets where id=2700;

Is that all i need to do?

Regards,
__
Steve Poirier
Project Manager
Inet-Technologies inc.


rt-users mailing list
rt-users@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-users


jesse reed vincent – root@eruditorum.orgjesse@fsck.com
70EBAC90: 2A07 FC22 7DB4 42C1 9D71 0108 41A3 3FB3 70EB AC90

. . . when not in doubt, get in doubt. – Old Discordian Proveb


rt-users mailing list
rt-users@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-users


jesse reed vincent – root@eruditorum.orgjesse@fsck.com
70EBAC90: 2A07 FC22 7DB4 42C1 9D71 0108 41A3 3FB3 70EB AC90

A REAL sysadmin challenge is “resurrect five dead mailserver while so
ripped to the gills on mdma that you can’t focus on any given line of
text for more
than 10 seconds continuously.”
-Nathan Mehl


rt-users mailing list
rt-users@lists.fsck.com http://lists.fsck.com/mailman/listinfo/rt-users


rt-users mailing list
rt-users@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-users