#36779: DeleteModel can lead to missing FK constraints
--------------------------------+--------------------------------------
     Reporter:  Jamie Cockburn  |                    Owner:  Vishy Algo
         Type:  Bug             |                   Status:  assigned
    Component:  Migrations      |                  Version:  6.0
     Severity:  Normal          |               Resolution:
     Keywords:                  |             Triage Stage:  Accepted
    Has patch:  1               |      Needs documentation:  0
  Needs tests:  0               |  Patch needs improvement:  1
Easy pickings:  0               |                    UI/UX:  0
--------------------------------+--------------------------------------
Changes (by Simon Charette):

 * cc: Simon Charette (added)

Comment:

 I'm not against a feature flag at all if we have a use for it but I can't
 reproduce the test failures you are alluding to by running the full SQLite
 test suite and it seems to be a propery required by third party backends
 to pass the full schema and migrations test suites.

 Given `sqlite3.DatabaseSchemaEditor.delete_model` completely ignores the
 `cascade` argument by when calling
 `base.DatabaseSchemaEditor.delete_model` though `super()` in the proposed
 patch and that only the later makes use of `sql_delete_table_cascade` I
 don't see how any code path can issue a `DROP TABLE {table} CASCADE` on
 SQLite.

 > This approach ensures the API is extensible and backward-compatible
 without breaking SQLite or third-party backends.

 Could you elaborate on what you mean by that? SQLite doesn't seem to be
 broken here (as pointed out above) and the default on all other core
 backends use to be to cascade by default (Oracle, Postgres, MySQL). All we
 did here is to change the default of `DropModel` to not cascade and allow
 the schema editor to take a more informed decision.

 Given the usage and expectations that `cascade=True` is implemented to get
 the schema and migrations test suite passing I don't see how
 `supports_table_drop_cascade = False` would be useful; third-party
 database backends must emulate it even if they don't support it natively.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36779#comment:9>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019b4e69761d-86008026-efb6-44a8-b527-cd8067ad10ee-000000%40eu-central-1.amazonses.com.

Reply via email to