Opened 2 years ago

Closed 2 years ago

#33248 closed Uncategorized (invalid)

inspectdb command doesn't introspect on_delete option.

Reported by: Jiangshan00001 Owned by: nobody
Component: Database layer (models, ORM) Version: 3.2
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

when i use inspectdb command.
the on_delete parameter of the ForeignKey field is always DO_NOTHING.
but my database is not set as DO_NOTHING.

I noticed that the output file has this line:
"Make sure each ForeignKey and OneToOneField has on_delete set to the desired behavior"

I'd like to know,
why no don't get the information from database?

is this a bug, or just no use for some reason?

Change History (1)

in reply to:  description comment:1 by Mariusz Felisiak, 2 years ago

Component: UncategorizedDatabase layer (models, ORM)
Resolution: invalid
Status: newclosed
Summary: inspectdb command. foreignkey on_delete always get DO_NOTHINGinspectdb command doesn't introspect on_delete option.

Replying to Jiangshan00001:

I'd like to know,
why no don't get the information from database?

is this a bug, or just no use for some reason?

Django doesn't support database-level cascade options and doesn’t create an SQL constraint in the database, so there is no way to introspect it, see #21961.

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