Drupal 7: verwaiste Kommentardaten löschen

Gespeichert von Erik Wegner am/um
Body

Diese Befehle löschen die Inhalte aus den Tabellen field_data_comment_body und field_data_revision_comment_body, deshalb leg vorher eine Sicherungskopie an!

DELETE t1.*
FROM field_data_comment_body t1
    LEFT JOIN comment t2 ON t1.entity_id = t2.cid
WHERE t2.cid IS NULL

DELETE t1.*
FROM field_revision_comment_body t1
    LEFT JOIN comment t2 ON t1.entity_id = t2.cid
WHERE t2.cid IS NULL

OPTIMIZE TABLE `field_data_comment_body` ,
`field_revision_comment_body`