Add a management command to clean up orphaned data.

Review Request #13740 — Created April 17, 2024 and submitted — Latest diff uploaded

Information

Review Board
release-7.x

Reviewers

This change adds a new management command that will clean up various
pieces of data in the database and filesystem that could have been left
behind if administrators used the "Delete Permanently" action on a
review request or deleted review requests via the admin UI.

It will query each of the affected items to get a total count, and then
perform the actual deletion in batches. This allows us to show nice
progress bars, as well as make the command interruptible.

Populated my database with a bunch of data including screenshots,
file attachments, diffs, and change descriptions. Temporarily disabled
our new signal handler and deleted the review requests.

  • Ran with --show-counts-only and saw the expected counts for each type
    of object.
  • Ran normally and watched it delete all the objects.
  • Ran again with --show-counts-only and saw that it no longer reported
    any orphaned data.
  • Set the batch size low and verified that the progress bars worked
    correctly.
  • Built and looked at the docs.

Commits

Files