Add migration for fixing old epic events
This is step 3 of #7385 (comment 207997970)
For a while (until !15649 (merged)) an event was created whenever an epic was commented these events were not associated with a group or project because Event
model could be associated only with a project. Since !15649 (merged) new epic and epic note events are properly associated with a group. But there are still old epic note events in database which don't have group_id
set.
Epic events are displayed on group activity page since 12.4 (!16108 (merged)).
Because we keep also target_type
and target_id
for each event (to identify event's resource), we should be able to go through all existing events which have target_type=Note and NULL project_id
and check if the note is for Epic and assign current epic group_id to these events.
The benefit of this fix from user point of view is relatively small - he would see events about epic comments on the activity page (note that this is only about epic note events, not about epic events which were not created before - so he wouldn't still see older events about creating or closing epics). But I think it's still good to address this fix to make sure we have data in DB consistent (IOW there are no "orphaned" events in the DB).
/cc @johnhope WDYT? Could you set an appropriate milestone?