Opened 3 years ago

Closed 10 months ago

#33481 closed Cleanup/optimization (fixed)

Clarify remove_stale_contenttypes data loss warning

Reported by: Johannes Maron Owned by: Syed Waheed
Component: contrib.contenttypes Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I just wanted to remove stale contenttypes from a system and noticed a pretty significant bug.

The command prints a message before you need to confirm the deletion that reads:

This list doesn't include any cascade deletions to data outside of Django's models (uncommon).

However, a quick investigation on the objects that are to be deleted includes objects outside of Django's scope.
In my case:

  • 2 auth.Group_permissions object(s)
  • 7185 joeflow.Task object(s)
  • 5519 joeflow.Task_parent_task_set object(s)

This misinformation can cause users to delete data without double-checking.

Change History (11)

comment:1 by Tim Graham, 3 years ago

I think you've misunderstood the message. The data you listed seem to be Django objects and relations. Why do you say they are "outside of Django's scope"? Aren't they printed as part of the deletion warning?

comment:2 by Johannes Maron, 3 years ago

Component: UncategorizedDocumentation
Severity: Release blockerNormal
Type: BugCleanup/optimization

Oooooh, now I get it. Wow, OK, is it just me, or is that sentence misleading? Maybe we replace that sentence something that doesn't include brackets at the end and not the term "Django's models"? Something a long the lines of:

The list above does not include deletions that may be caused by manually added database constraints or triggers.

comment:3 by Tim Graham, 3 years ago

Component: Documentationcontrib.contenttypes
Summary: remove_stale_contenttypes causes data lossClarify remove_stale_contenttypes data loss warning
Triage Stage: UnreviewedAccepted

I wrote the original sentence in e2dfa81ff7489d97700604d634adacf1384af184. I guess you may have interpreted "Django's models" to mean contrib.auth? I don't have an objection to some rewording but for me, it's more intuitive to talk about "cascade deletions" and "relations" rather than "constraints or triggers." Feel free to submit a PR to continue the discussion with a merger.

comment:4 by Syed Waheed, 11 months ago

Owner: changed from nobody to Syed Waheed
Status: newassigned

comment:5 by Syed Waheed, 10 months ago

i have made the changes in the warning

comment:6 by Syed Waheed, 10 months ago

link to my fork - https://github.com/Waheedsys/django
link to my commit - https://github.com/django/django/compare/main...Waheedsys:django:main
I would like to have a review of the changes

in reply to:  6 comment:7 by Mariusz Felisiak, 10 months ago

Replying to Syed Waheed:

link to my fork - https://github.com/Waheedsys/django
link to my commit - https://github.com/django/django/compare/main...Waheedsys:django:main
I would like to have a review of the changes

Please send a patch via GitHub PR (check out docs for more details).

comment:9 by Mariusz Felisiak, 10 months ago

Has patch: set
Patch needs improvement: set

comment:10 by Mariusz Felisiak, 10 months ago

Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

comment:11 by Mariusz Felisiak <felisiak.mariusz@…>, 10 months ago

Resolution: fixed
Status: assignedclosed

In 415982b:

Fixed #33481 -- Clarified remove_stale_contenttypes data loss warning.

Note: See TracTickets for help on using tickets.
Back to Top