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
May 7, 2017, 6:28 PM

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
Your pinned fields
Click on the next to a field label to start pinning.

Assignee

Stephen Marquard

Reporter

Stephen Marquard

Severity

Incorrectly Functioning Without Workaround