Add a management command to clean up orphaned data.
Review Request #13740 — Created April 17, 2024 and submitted
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.
Summary | ID |
---|---|
e45b6c7f2d5c4d59c0c67d381f2cbf62dffef994 |
Description | From | Last Updated |
---|---|---|
continuation line over-indented for visual indent Column: 21 Error code: E127 |
reviewbot | |
We should go with "data" or "objects" here instead of "file attachments" to be more general. Same with the module … |
maubin | |
This should be taken out. |
maubin | |
This is missing a ::. |
chipx86 | |
I think this needs to be gettext_lazy. |
chipx86 | |
Small nit: One per line would help keep this readable/more maintainable if we need to expand upon this. |
chipx86 | |
Same here. |
chipx86 | |
Keyword-only arguments would help make this a bit more readable. |
chipx86 |
- Commits:
-
Summary ID 4c068c4256f752f89fb54d60dec07f85cb52e0ac f266db310c633d0835b5ef664459bc1ebc9df2a7
Checks run (2 succeeded)
- Commits:
-
Summary ID f266db310c633d0835b5ef664459bc1ebc9df2a7 c2b6a24dac4832e5b7a0f322948ce64ac2c83e8b
Checks run (2 succeeded)
-
This looks good.
Some small suggestions to help with readability, but overall looks good.
As a suggestion for a possible feature, it might be nice to be able to get a list of the IDs for each type of object that's going to be deleted so it can be audited or manually dealt with prior to actually invoking a deletion. But not a blocker for this change by any means.
-
-
-
Small nit: One per line would help keep this readable/more maintainable if we need to expand upon this.
-
-