Opened 8 years ago

Closed 8 years ago

#26989 closed New feature (duplicate)

Provide a way of specifying ON DELETE and On UPDATE properties in model DDL

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


I have read [1] and I understand that in general Django has good reasons for emulating ON DELETE behaviour such as ON DELETE CASCADE. However we have a case where the database native support is sufficient to meet our needs, and will provide a performance win on a problematically-slow bulk delete operation. It is possible for us to configure this e.g. by using a migration with a RawSQL operation, but if we take this approach we no longer have the ability to recreate the full database state from the django model. Therefore it would be helpful if there was a way to specify these properties in the model, even if django does not rely on them during normal operations.

This would provide feature parity with SQLAlchemy in this area, which also uses emulated cascading behaviour by default, but allows specifying the schema-level constructs to be specified in the DDL [2].


Change History (2)

comment:1 by Ed Morley, 8 years ago

Cc: emorley@… added

comment:2 by Tim Graham, 8 years ago

Component: UncategorizedDatabase layer (models, ORM)
Resolution: duplicate
Status: newclosed
Type: UncategorizedNew feature

Duplicate of #21961 (ON DELETE) and #21295 (ON UPDATE).

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