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 |
Description
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].
[1] https://groups.google.com/forum/#%21topic/django-developers/FGDanrS9vlw
[2] http://docs.sqlalchemy.org/en/rel_1_0/orm/cascades.html#delete
Change History (2)
comment:1 by , 8 years ago
Cc: | added |
---|
comment:2 by , 8 years ago
Component: | Uncategorized → Database layer (models, ORM) |
---|---|
Resolution: | → duplicate |
Status: | new → closed |
Type: | Uncategorized → New feature |
Duplicate of #21961 (ON DELETE) and #21295 (ON UPDATE).