-- duplicate the "removed private information" row into a comment log entry for the requester comment.
insert into log
select null id, c.id objectid, 'Comment' objecttype, l.user, 'EditComment-c' action, l.timestamp, null comment, 0 updateversion
from log l
inner join request r on l.objectid = r.id and l.objecttype = 'Request'
inner join comment c on r.id = c.request
where l.action in ('Removed private information via database')
and c.visibility = 'requester'
union all select * from log l where l.action in ('Removed private information via database');
-- change the existing "remove private information" log entries to the correct action for the request log
update log l set action = 'EditComment-r' where l.action in ('Removed private information via database');
-- add a comment on the requests for the discarded requests
insert into comment select null, l.timestamp, l.user, l.action, 'user', l.objectid, 0 from log l where action = 'Discarded as likely a spambot';
-- change the log action to a drop for the discarded requests
update log set action = 'Closed 0' where action = 'Discarded as likely a spambot';