I'm part of the way working through a solution for this for MySQL. I just need to finish off the tests and documentation then it will be up on GitHub I just had to put it on hold but it fixes an issue in MySQL 5.7+ for Django that otherwise occurs if the database you are using is used by anything outside of Django that may need to perform deletes
On Monday, 7 March 2022 at 20:53:30 UTC charettes wrote: > If you're interested in following the development of the database level > foreign key constraints feature you should CC to #21961 [0] > > The latest attempt at implementing them was recently closed due to > inactivity [1] > > Cheers, > Simon > > [0] https://code.djangoproject.com/ticket/21961 > [1] https://github.com/django/django/pull/14550 > > Le lundi 7 mars 2022 à 14:32:20 UTC-5, Adam Johnson a écrit : > >> No, there is not currently a way in Django to declare such constraints. >> You can always create them in a migration using the RawSQL operation, then >> rely on them in your code. >> >> This blog post relates to custom relationships which would allow you to >> model them, I think: >> https://schinckel.net/2021/07/14/django-implied-relationship/ >> >> >> On Mon, Mar 7, 2022 at 5:43 PM dans...@gmail.com <dans...@gmail.com> >> wrote: >> >>> Hi guys, >>> >>> I remember that there is a new way to declare constraints in class Meta >>> on a model, and that this is preferable for unique_together constraints. >>> >>> I've long wanted a way with Django to have database foreign key >>> constraints cascade in the database rather than via Django. Is there now >>> a way to do this? >>> >>> Thanks! >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Django developers (Contributions to Django itself)" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to django-develop...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/django-developers/3e28c4b0-896d-49fa-b768-a30c3db96c23n%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/django-developers/3e28c4b0-896d-49fa-b768-a30c3db96c23n%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/32750b80-d310-452a-8c7f-01914744bb64n%40googlegroups.com.