Deleting an event leaves behind orphaned comments

Steps to reproduce

Steps to reproduce:
1. Create an event
2. Add a comment to the event
3. Delete the event

Inspect database with:

mysql> select* from mh_event_comment where event not in (select id from mh_archive_episode);

Actual Results:

Comments associated with the event should be removed from the database.

Expected Results:

Comments should be removed from the db.

Workaround (if any):

Clean up db manually.

Activity

Show:
Stephen Marquard
April 15, 2017, 1:13 AM
Edited

Orphaned comments:

mysql> select * from mh_event_comment where event not in (select id from mh_archive_episode where deleted='0') and event not in (select mediapackage_id from mh_scheduled_event);

Stephen Marquard
April 15, 2017, 1:38 AM
Stephen Marquard
May 8, 2017, 4:28 AM

Cleanup:

delete from mh_event_comment where event not in (select id from mh_archive_episode where deleted='0') and event not in (select mediapackage_id from mh_scheduled_event);

select * from mh_event_comment where event not in (select id from mh_archive_episode where deleted='0') and event not in (select mediapackage_id from mh_scheduled_event);

This turns out to be a bit more complex than at first glance, because the archive/episode manager in 2.x does a soft delete (deleted='1' in mh_episode_archive). Arguably everything dependent (including comments) should also then be soft-deleted, but there's no provision for that in the data model currently.

Fixed and reviewed

Assignee

Stephen Marquard

Reporter

Stephen Marquard

Severity

Incorrectly Functioning Without Workaround

Tags (folksonomy)

None

Fix versions

Affects versions

Priority

Minor