Add on_delete to ForeignKey definitions.

Review Request #11988 — Created Jan. 24, 2022 and submitted — Latest diff uploaded

Information

Review Board
master

Reviewers

Django has made the on_delete argument to ForeignKey mandatory.
Until now, this has defaulted to CASCADE, which makes it easy to
unintentionally delete things that shouldn't be deleted. Making it a
required argument forces developers to think about each model and how it
should behave.

This change explicitly sets on_delete for every relation we have. Most
of these are CASCADE, but the diff data ones are SET_NULL because
those are effectively a one-to-many relation, and we don't want to
delete diff data that may be shared by other diffs.

Ran unit tests.

Commits

Files