Skip to content

Commit

Permalink
ref(backup): Remove ManyToMany dependencies (#54480)
Browse files Browse the repository at this point in the history
The `sorted_dependencies` function has, since time immemorial, tried to
track all `ManyToManyField` dependencies without a `through` model set,
since there is otherwise no way to deduce the dependency relationship
for the shadow junction tables Django creates under the hood. Except...
we actually don't have any `ManyToManyField` definitions without an
explicit `through` argument. Maybe we did when this code was written,
but today we no longer do.

The removed bits of code were thus never really executed, since they
were checking for a state of affairs that wasn't really a problem in our
actual code base. They were also buggy: the comment said they were
checking for `through`-ness, but there was no code to this effect,
resulting in double dependencies.

This change removes the check altogether, and adds an invariant test to
ensure that all `ManyToManyField`s defined in the future carry a
`through` argument.

Issue: getsentry/team-ospo#171
  • Loading branch information
azaslavsky authored Aug 11, 2023
1 parent 8f8139a commit 41e17be
Show file tree
Hide file tree
Showing 6 changed files with 483 additions and 542 deletions.
Loading

0 comments on commit 41e17be

Please sign in to comment.