Skip to content
Snippets Groups Projects
  • Konrad Mohrfeldt's avatar
    fec41ab1
    fix: handle episode deletions in timeslot repetition_of_id field · fec41ab1
    Konrad Mohrfeldt authored
    The update logic of the repetition_of field did not consider cases in
    which the episode field of TimeSlot objects is deleted.
    
    This fix populates the TimeSlot’s repetition_of_id field with a subquery
    instead of using a separate database field for it.
    
    The decision to keep repetition_of as a separate database field was made
    on the assumption that this would be a performance problem. However, the
    subquery for the repetition_of field is quite performant, especially
    with a separate database index. In contrast, the update logic for a
    materialized repetition_of field is quite complex and it is easy to miss
    cases that should have updated the field.
    
    As long as we don’t have an actual use case in which retrieving
    timeslots becomes slow because of this subquery, we should refrain from
    materializing the field.
    fec41ab1
    History
    fix: handle episode deletions in timeslot repetition_of_id field
    Konrad Mohrfeldt authored
    The update logic of the repetition_of field did not consider cases in
    which the episode field of TimeSlot objects is deleted.
    
    This fix populates the TimeSlot’s repetition_of_id field with a subquery
    instead of using a separate database field for it.
    
    The decision to keep repetition_of as a separate database field was made
    on the assumption that this would be a performance problem. However, the
    subquery for the repetition_of field is quite performant, especially
    with a separate database index. In contrast, the update logic for a
    materialized repetition_of field is quite complex and it is easy to miss
    cases that should have updated the field.
    
    As long as we don’t have an actual use case in which retrieving
    timeslots becomes slow because of this subquery, we should refrain from
    materializing the field.