Today I needed to alter the content of a comment made on a Trac ticket. I didn’t anticipate this would be a difficult task, but I wasn’t too familiar with Trac’s DB schema. So to save you a few consternated queries, here’s the spoiler. Comments on tickets aren’t kept within their own table (as you might expect) but are instead stored in the ticket_change table.
In my particular case the Trac DB was MySQL, so the examples I’ll provide will be MySQL queries. If you have an SQLite-backed Trac the operations should be the same, you’ll just need to use SQLite’s syntax.
Say the ticket with the naughty comment is #1234. To see all comments on this ticket:
1 2 3 | SELECT * FROM trac.ticket_change WHERE FIELD = "comment" AND ticket = 1234; |
And to update a comment:
1 2 3 4 5 | UPDATE trac.ticket_change SET newvalue = "New hotness" WHERE FIELD = "comment" AND ticket = 1234 AND oldvalue = "Old and busted"; |
Happy revisionizing.
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.








