• 
      

    Delete related objects when deleting a review request.

    Review Request #13735 — Created April 16, 2024 and submitted — Latest diff uploaded

    Information

    Review Board
    release-7.x

    Reviewers

    We never really designed Review Board to delete data, and we (at least
    I) also didn't fully understand how foreign keys and deletion worked
    when we first designed many aspects of our database schema. The result
    of this is that when a review request was deleted, we'd leave a bunch of
    related things in the database, now completely orphaned. The biggest
    offender here was file attachments, which not only use up space in the
    database, but can also use up a lot of space on the filesystem.

    This change adds a new signal handler for pre_delete on
    ReviewRequest. In this handler, we explicitly delete change
    descriptions, file attachments (both active and inactive), screenshots
    (both active and inactive), and the diffset history.

    A future change will add a management command to clean up any existing
    orphaned objects.

    • Ran unit tests.
    • Individually disabled lines in the signal handler and verified that
      without this, we were leaving these objects in the DB, and with it,
      they get deleted.

    Commits

    Files